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 | #if HAVE_SSE | ||||
static bool g_EnableSSE = false; | static bool g_EnableSSE = false; | ||||
#endif | #endif | ||||
void ModelRenderer::Init() | void ModelRenderer::Init() | ||||
{ | { | ||||
#if HAVE_SSE | |||||
#if ARCH_X86_X64 | |||||
# include "lib/sysdep/arch/x86_x64/x86_x64.h" | |||||
#endif | |||||
#if ARCH_X86_X64 | #if ARCH_X86_X64 | ||||
if (x86_x64::Cap(x86_x64::CAP_SSE)) | static bool g_EnableSSE = x86_x64::Cap(x86_x64::CAP_SSE); | ||||
g_EnableSSE = true; | #elif ARCH_E2K | ||||
static bool g_EnableSSE = true; | |||||
#else | |||||
static bool g_EnableSSE = false; | |||||
#endif | #endif | ||||
#endif // if HAVE_SSE | |||||
} | } | ||||
// 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 25 Lines | if (model->IsSkinned()) | ||||
// 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 | ||||
if (g_EnableSSE) | if (g_EnableSSE) | ||||
Stan: here ^ | |||||
{ | { | ||||
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
here ^