Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/ModelRenderer.cpp
Show All 22 Lines | |||||
#include "graphics/Model.h" | #include "graphics/Model.h" | ||||
#include "graphics/ModelDef.h" | #include "graphics/ModelDef.h" | ||||
#include "graphics/ShaderManager.h" | #include "graphics/ShaderManager.h" | ||||
#include "graphics/TextureManager.h" | #include "graphics/TextureManager.h" | ||||
#include "lib/allocators/allocator_adapters.h" | #include "lib/allocators/allocator_adapters.h" | ||||
#include "lib/allocators/arena.h" | #include "lib/allocators/arena.h" | ||||
#include "lib/hash.h" | #include "lib/hash.h" | ||||
#include "lib/ogl.h" | #include "lib/ogl.h" | ||||
#include "lib/sse.h" | |||||
#include "maths/Vector3D.h" | #include "maths/Vector3D.h" | ||||
#include "maths/Vector4D.h" | #include "maths/Vector4D.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "renderer/MikktspaceWrap.h" | #include "renderer/MikktspaceWrap.h" | ||||
#include "renderer/ModelRenderer.h" | #include "renderer/ModelRenderer.h" | ||||
#include "renderer/ModelVertexRenderer.h" | #include "renderer/ModelVertexRenderer.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
#include "renderer/RenderModifiers.h" | #include "renderer/RenderModifiers.h" | ||||
#include "renderer/SkyManager.h" | #include "renderer/SkyManager.h" | ||||
#include "renderer/TimeManager.h" | #include "renderer/TimeManager.h" | ||||
#include "renderer/WaterManager.h" | #include "renderer/WaterManager.h" | ||||
#if ARCH_X86_X64 | #if ARCH_X86_X64 | ||||
# include "lib/sysdep/arch/x86_x64/x86_x64.h" | # include "lib/sysdep/arch/x86_x64/x86_x64.h" | ||||
#endif | #endif | ||||
/////////////////////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////////////////////// | ||||
// ModelRenderer implementation | // ModelRenderer implementation | ||||
#if ARCH_X86_X64 | |||||
static bool g_EnableSSE = false; | |||||
#endif | |||||
void ModelRenderer::Init() | void ModelRenderer::Init() | ||||
{ | { | ||||
#if ARCH_X86_X64 | |||||
if (x86_x64::Cap(x86_x64::CAP_SSE)) | |||||
g_EnableSSE = true; | |||||
#endif | |||||
} | } | ||||
// Helper function to copy object-space position and normal vectors into arrays. | // Helper function to copy object-space position and normal vectors into arrays. | ||||
void ModelRenderer::CopyPositionAndNormals( | void ModelRenderer::CopyPositionAndNormals( | ||||
const CModelDefPtr& mdef, | const CModelDefPtr& mdef, | ||||
const VertexArrayIterator<CVector3D>& Position, | const VertexArrayIterator<CVector3D>& Position, | ||||
const VertexArrayIterator<CVector3D>& Normal) | const VertexArrayIterator<CVector3D>& Normal) | ||||
{ | { | ||||
Show All 24 Lines | if (model->IsSkinned()) | ||||
// Avoid the noisy warnings that occur inside SkinPoint/SkinNormal in | // Avoid the noisy warnings that occur inside SkinPoint/SkinNormal in | ||||
// some broken situations | // some broken situations | ||||
if (numVertices && vertices[0].m_Blend.m_Bone[0] == 0xff) | if (numVertices && vertices[0].m_Blend.m_Bone[0] == 0xff) | ||||
{ | { | ||||
LOGERROR("Model %s is boned with unboned animation", mdef->GetName().string8()); | LOGERROR("Model %s is boned with unboned animation", mdef->GetName().string8()); | ||||
return; | return; | ||||
} | } | ||||
#if HAVE_SSE | #if HAVE_SSE | ||||
wraitii: Remove the if here or things won't work as you expect. | |||||
if (g_EnableSSE) | if (HasSSE()) | ||||
{ | { | ||||
CModelDef::SkinPointsAndNormals_SSE(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | CModelDef::SkinPointsAndNormals_SSE(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | ||||
} | } | ||||
else | else | ||||
#endif | #endif | ||||
{ | { | ||||
CModelDef::SkinPointsAndNormals(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | CModelDef::SkinPointsAndNormals(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 663 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Remove the if here or things won't work as you expect.