Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/PatchRData.cpp
Show First 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | void CPatchRData::AddBlend(std::vector<SBlendVertex>& blendVertices, std::vector<u16>& blendIndices, | ||||
vtx[(base + 3) % 4].m_AlphaUVs[0] = u0; | vtx[(base + 3) % 4].m_AlphaUVs[0] = u0; | ||||
vtx[(base + 3) % 4].m_AlphaUVs[1] = v1; | vtx[(base + 3) % 4].m_AlphaUVs[1] = v1; | ||||
SBlendVertex dst; | SBlendVertex dst; | ||||
const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | ||||
CVector3D normal; | CVector3D normal; | ||||
bool cpuLighting = (g_Renderer.GetRenderPath() == CRenderer::RP_FIXED); | bool cpuLighting = (g_RenderingOptions.GetRenderPath() == RenderPath::FIXED); | ||||
size_t index = blendVertices.size(); | size_t index = blendVertices.size(); | ||||
terrain->CalcPosition(gx, gz, dst.m_Position); | terrain->CalcPosition(gx, gz, dst.m_Position); | ||||
terrain->CalcNormal(gx, gz, normal); | terrain->CalcNormal(gx, gz, normal); | ||||
dst.m_Normal = normal; | dst.m_Normal = normal; | ||||
dst.m_DiffuseColor = cpuLighting ? lightEnv.EvaluateTerrainDiffuseScaled(normal) : lightEnv.EvaluateTerrainDiffuseFactor(normal); | dst.m_DiffuseColor = cpuLighting ? lightEnv.EvaluateTerrainDiffuseScaled(normal) : lightEnv.EvaluateTerrainDiffuseFactor(normal); | ||||
dst.m_AlphaUVs[0] = vtx[0].m_AlphaUVs[0]; | dst.m_AlphaUVs[0] = vtx[0].m_AlphaUVs[0]; | ||||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | void CPatchRData::BuildVertices() | ||||
// get index of this patch | // get index of this patch | ||||
ssize_t px=m_Patch->m_X; | ssize_t px=m_Patch->m_X; | ||||
ssize_t pz=m_Patch->m_Z; | ssize_t pz=m_Patch->m_Z; | ||||
CTerrain* terrain=m_Patch->m_Parent; | CTerrain* terrain=m_Patch->m_Parent; | ||||
const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | const CLightEnv& lightEnv = g_Renderer.GetLightEnv(); | ||||
bool cpuLighting = (g_Renderer.GetRenderPath() == CRenderer::RP_FIXED); | bool cpuLighting = (g_RenderingOptions.GetRenderPath() == RenderPath::FIXED); | ||||
// build vertices | // build vertices | ||||
for (ssize_t j=0;j<vsize;j++) { | for (ssize_t j=0;j<vsize;j++) { | ||||
for (ssize_t i=0;i<vsize;i++) { | for (ssize_t i=0;i<vsize;i++) { | ||||
ssize_t ix=px*PATCH_SIZE+i; | ssize_t ix=px*PATCH_SIZE+i; | ||||
ssize_t iz=pz*PATCH_SIZE+j; | ssize_t iz=pz*PATCH_SIZE+j; | ||||
ssize_t v=(j*vsize)+i; | ssize_t v=(j*vsize)+i; | ||||
▲ Show 20 Lines • Show All 986 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator