Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/ModelRenderer.cpp
Show All 35 Lines | |||||
#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 | |||||
# include "lib/sysdep/arch/x86_x64/x86_x64.h" | |||||
#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 23 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 (g_EnableSSE) | |||||
{ | |||||
CModelDef::SkinPointsAndNormals_SSE(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | |||||
} | |||||
else | |||||
#endif | |||||
{ | |||||
CModelDef::SkinPointsAndNormals(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | CModelDef::SkinPointsAndNormals(numVertices, Position, Normal, vertices, mdef->GetBlendIndices(), model->GetAnimatedBoneMatrices()); | ||||
wraitii: Remove the if here or things won't work as you expect. | |||||
} | } | ||||
} | |||||
else | else | ||||
{ | { | ||||
PROFILE("software transform"); | PROFILE("software transform"); | ||||
// just copy regular positions, transform normals to world space | // just copy regular positions, transform normals to world space | ||||
const CMatrix3D& transform = model->GetTransform(); | const CMatrix3D& transform = model->GetTransform(); | ||||
const CMatrix3D& invtransform = model->GetInvTransform(); | const CMatrix3D& invtransform = model->GetInvTransform(); | ||||
for (size_t j = 0; j < numVertices; ++j) | for (size_t j = 0; j < numVertices; ++j) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 654 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Remove the if here or things won't work as you expect.