improved cpp conformance

This commit is contained in:
Turanszki Janos
2020-06-12 22:09:04 +01:00
parent 7b6b796bbf
commit fefc361087
16 changed files with 58 additions and 40 deletions
+4
View File
@@ -107,6 +107,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -132,6 +133,7 @@
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -165,6 +167,7 @@
<ExceptionHandling>Sync</ExceptionHandling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -190,6 +193,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+12 -12
View File
@@ -421,19 +421,19 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
material.reflectance = 0.02f;
// metallic-roughness workflow:
auto& baseColorTexture = x.values.find("baseColorTexture");
auto& metallicRoughnessTexture = x.values.find("metallicRoughnessTexture");
auto& baseColorFactor = x.values.find("baseColorFactor");
auto& roughnessFactor = x.values.find("roughnessFactor");
auto& metallicFactor = x.values.find("metallicFactor");
auto baseColorTexture = x.values.find("baseColorTexture");
auto metallicRoughnessTexture = x.values.find("metallicRoughnessTexture");
auto baseColorFactor = x.values.find("baseColorFactor");
auto roughnessFactor = x.values.find("roughnessFactor");
auto metallicFactor = x.values.find("metallicFactor");
// common workflow:
auto& normalTexture = x.additionalValues.find("normalTexture");
auto& emissiveTexture = x.additionalValues.find("emissiveTexture");
auto& occlusionTexture = x.additionalValues.find("occlusionTexture");
auto& emissiveFactor = x.additionalValues.find("emissiveFactor");
auto& alphaCutoff = x.additionalValues.find("alphaCutoff");
auto& alphaMode = x.additionalValues.find("alphaMode");
auto normalTexture = x.additionalValues.find("normalTexture");
auto emissiveTexture = x.additionalValues.find("emissiveTexture");
auto occlusionTexture = x.additionalValues.find("occlusionTexture");
auto emissiveFactor = x.additionalValues.find("emissiveFactor");
auto alphaCutoff = x.additionalValues.find("alphaCutoff");
auto alphaMode = x.additionalValues.find("alphaMode");
if (baseColorTexture != x.values.end())
@@ -514,7 +514,7 @@ void ImportModel_GLTF(const std::string& fileName, Scene& scene)
}
// specular-glossiness workflow (todo):
auto& specularGlossinessWorkflow = x.extensions.find("KHR_materials_pbrSpecularGlossiness");
auto specularGlossinessWorkflow = x.extensions.find("KHR_materials_pbrSpecularGlossiness");
if (specularGlossinessWorkflow != x.extensions.end())
{
material.SetUseSpecularGlossinessWorkflow(true);
@@ -101,6 +101,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -118,6 +119,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -133,6 +135,7 @@
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -151,6 +154,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+4
View File
@@ -106,6 +106,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -124,6 +125,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -140,6 +142,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -158,6 +161,7 @@
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../WickedEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -105,6 +105,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -137,6 +138,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -169,6 +171,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -197,6 +200,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
+3 -1
View File
@@ -1,7 +1,9 @@
#pragma once
#include "CommonInclude.h"
#include <memory>
#include <vector>
#include <string>
namespace wiGraphics
{
@@ -334,7 +336,7 @@ namespace wiGraphics
{
static const uint32_t APPEND_ALIGNED_ELEMENT = 0xffffffff; // automatically figure out AlignedByteOffset depending on Format
char* SemanticName = nullptr;
std::string SemanticName;
uint32_t SemanticIndex = 0;
FORMAT Format = FORMAT_UNKNOWN;
uint32_t InputSlot = 0;
+1 -1
View File
@@ -1572,7 +1572,7 @@ bool GraphicsDevice_DX11::CreateInputLayout(const InputLayoutDesc *pInputElement
std::vector<D3D11_INPUT_ELEMENT_DESC> desc(NumElements);
for (uint32_t i = 0; i < NumElements; ++i)
{
desc[i].SemanticName = pInputElementDescs[i].SemanticName;
desc[i].SemanticName = pInputElementDescs[i].SemanticName.c_str();
desc[i].SemanticIndex = pInputElementDescs[i].SemanticIndex;
desc[i].Format = _ConvertFormat(pInputElementDescs[i].Format);
desc[i].InputSlot = pInputElementDescs[i].InputSlot;
+1 -1
View File
@@ -3652,7 +3652,7 @@ using namespace DX12_Internal;
elements.resize(desc.InputLayout.NumElements);
for (uint32_t i = 0; i < desc.InputLayout.NumElements; ++i)
{
elements[i].SemanticName = pso->desc.il->desc[i].SemanticName;
elements[i].SemanticName = pso->desc.il->desc[i].SemanticName.c_str();
elements[i].SemanticIndex = pso->desc.il->desc[i].SemanticIndex;
elements[i].Format = _ConvertFormat(pso->desc.il->desc[i].Format);
elements[i].InputSlot = pso->desc.il->desc[i].InputSlot;
+1 -1
View File
@@ -62,7 +62,7 @@ float AABB::getArea() const
return (_max.x - _min.x)*(_max.y - _min.y)*(_max.z - _min.z);
}
float AABB::getRadius() const {
XMFLOAT3& abc = getHalfWidth();
XMFLOAT3 abc = getHalfWidth();
return std::max(std::max(abc.x, abc.y), abc.z);
}
AABB::INTERSECTION_TYPE AABB::intersects(const AABB& b) const {
+14 -14
View File
@@ -17,8 +17,8 @@ namespace wiMath
}
inline float Distance(const XMVECTOR& v1, const XMVECTOR& v2)
{
XMVECTOR& vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR& length = XMVector3Length(vectorSub);
XMVECTOR vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR length = XMVector3Length(vectorSub);
float Distance = 0.0f;
XMStoreFloat(&Distance, length);
@@ -26,8 +26,8 @@ namespace wiMath
}
inline float DistanceSquared(const XMVECTOR& v1, const XMVECTOR& v2)
{
XMVECTOR& vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR& length = XMVector3LengthSq(vectorSub);
XMVECTOR vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR length = XMVector3LengthSq(vectorSub);
float Distance = 0.0f;
XMStoreFloat(&Distance, length);
@@ -35,8 +35,8 @@ namespace wiMath
}
inline float DistanceEstimated(const XMVECTOR& v1, const XMVECTOR& v2)
{
XMVECTOR& vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR& length = XMVector3LengthEst(vectorSub);
XMVECTOR vectorSub = XMVectorSubtract(v1, v2);
XMVECTOR length = XMVector3LengthEst(vectorSub);
float Distance = 0.0f;
XMStoreFloat(&Distance, length);
@@ -44,26 +44,26 @@ namespace wiMath
}
inline float Distance(const XMFLOAT2& v1, const XMFLOAT2& v2)
{
XMVECTOR& vector1 = XMLoadFloat2(&v1);
XMVECTOR& vector2 = XMLoadFloat2(&v2);
XMVECTOR vector1 = XMLoadFloat2(&v1);
XMVECTOR vector2 = XMLoadFloat2(&v2);
return XMVectorGetX(XMVector2Length(vector2 - vector1));
}
inline float Distance(const XMFLOAT3& v1, const XMFLOAT3& v2)
{
XMVECTOR& vector1 = XMLoadFloat3(&v1);
XMVECTOR& vector2 = XMLoadFloat3(&v2);
XMVECTOR vector1 = XMLoadFloat3(&v1);
XMVECTOR vector2 = XMLoadFloat3(&v2);
return Distance(vector1, vector2);
}
inline float DistanceSquared(const XMFLOAT3& v1, const XMFLOAT3& v2)
{
XMVECTOR& vector1 = XMLoadFloat3(&v1);
XMVECTOR& vector2 = XMLoadFloat3(&v2);
XMVECTOR vector1 = XMLoadFloat3(&v1);
XMVECTOR vector2 = XMLoadFloat3(&v2);
return DistanceSquared(vector1, vector2);
}
inline float DistanceEstimated(const XMFLOAT3& v1, const XMFLOAT3& v2)
{
XMVECTOR& vector1 = XMLoadFloat3(&v1);
XMVECTOR& vector2 = XMLoadFloat3(&v2);
XMVECTOR vector1 = XMLoadFloat3(&v1);
XMVECTOR vector2 = XMLoadFloat3(&v2);
return DistanceEstimated(vector1, vector2);
}
inline XMVECTOR ClosestPointOnLine(const XMVECTOR& A, const XMVECTOR& B, const XMVECTOR& Point)
+1 -1
View File
@@ -178,7 +178,7 @@ namespace wiProfiler
lock.lock();
auto& it = ranges.find(id);
auto it = ranges.find(id);
if (it != ranges.end())
{
if (it->second.IsCPURange())
+3 -3
View File
@@ -11446,9 +11446,9 @@ RAY GetPickRay(long cursorX, long cursorY)
XMMATRIX V = camera.GetView();
XMMATRIX P = camera.GetProjection();
XMMATRIX W = XMMatrixIdentity();
XMVECTOR& lineStart = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 1, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
XMVECTOR& lineEnd = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 0, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
XMVECTOR& rayDirection = XMVector3Normalize(XMVectorSubtract(lineEnd, lineStart));
XMVECTOR lineStart = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 1, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
XMVECTOR lineEnd = XMVector3Unproject(XMVectorSet((float)cursorX, (float)cursorY, 0, 1), 0, 0, screenW, screenH, 0.0f, 1.0f, P, V, W);
XMVECTOR rayDirection = XMVector3Normalize(XMVectorSubtract(lineEnd, lineStart));
return RAY(lineStart, rayDirection);
}
+1 -1
View File
@@ -69,7 +69,7 @@ namespace wiResourceManager
// dynamic type selection:
{
auto& it = types.find(ext);
auto it = types.find(ext);
if (it != types.end())
{
type = it->second;
+1 -1
View File
@@ -372,7 +372,7 @@ namespace wiScene
for (size_t i = 0; i < vertices.size(); ++i)
{
const XMFLOAT3& pos = vertex_positions[i];
XMFLOAT3& nor = vertex_normals.empty() ? XMFLOAT3(1, 1, 1) : vertex_normals[i];
XMFLOAT3 nor = vertex_normals.empty() ? XMFLOAT3(1, 1, 1) : vertex_normals[i];
XMStoreFloat3(&nor, XMVector3Normalize(XMLoadFloat3(&nor)));
const uint8_t wind = vertex_windweights.empty() ? 0xFF : vertex_windweights[i];
vertices[i].FromFULL(pos, nor, wind);
+3 -3
View File
@@ -122,7 +122,7 @@ int Pick(lua_State* L)
}
}
}
auto& pick = wiScene::Pick(ray->ray, renderTypeMask, layerMask, *scene);
auto pick = wiScene::Pick(ray->ray, renderTypeMask, layerMask, *scene);
wiLua::SSetLongLong(L, pick.entity);
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.position)));
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.normal)));
@@ -172,7 +172,7 @@ int SceneIntersectSphere(lua_State* L)
}
}
}
auto& pick = wiScene::SceneIntersectSphere(sphere->sphere, renderTypeMask, layerMask, *scene);
auto pick = wiScene::SceneIntersectSphere(sphere->sphere, renderTypeMask, layerMask, *scene);
wiLua::SSetLongLong(L, pick.entity);
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.position)));
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.normal)));
@@ -222,7 +222,7 @@ int SceneIntersectCapsule(lua_State* L)
}
}
}
auto& pick = wiScene::SceneIntersectCapsule(capsule->capsule, renderTypeMask, layerMask, *scene);
auto pick = wiScene::SceneIntersectCapsule(capsule->capsule, renderTypeMask, layerMask, *scene);
wiLua::SSetLongLong(L, pick.entity);
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.position)));
Luna<Vector_BindLua>::push(L, new Vector_BindLua(XMLoadFloat3(&pick.normal)));
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 42;
// minor bug fixes, alterations, refactors, updates
const int revision = 7;
const int revision = 8;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);