18 #include "precompiled.h"
63 m_Patch(patch), m_VBSides(0),
64 m_VBBase(0), m_VBBaseIndices(0),
65 m_VBBlends(0), m_VBBlendIndices(0),
66 m_VBWater(0), m_VBWaterIndices(0),
67 m_Simulation(simulation)
149 std::vector<SBlendVertex> blendVertices;
150 std::vector<u16> blendIndices;
154 std::vector<STileBlendStack> blendStacks;
165 std::vector<STileBlend> blends;
169 for (
size_t n = 0; n < 9; ++n)
172 ssize_t oz = gz + BlendOffsets[n][0];
182 blends.push_back(blend);
193 for (
size_t k = 0; k < blends.size(); ++k)
195 if (!blendStack.blends.empty() && blendStack.blends.back().m_Texture == blends[k].m_Texture)
196 blendStack.blends.back().m_TileMask |= blends[k].m_TileMask;
198 blendStack.blends.push_back(blends[k]);
204 blendStack.blends.erase(
206 blendStack.blends.end());
208 blendStacks.push_back(blendStack);
217 std::vector<SBlendLayer> blendLayers;
221 if (!blendLayers.empty())
228 for (
size_t k = 0; k < blendStacks.size(); ++k)
230 if (!blendStacks[k].blends.empty() && blendStacks[k].blends.back().m_Texture == tex)
232 SBlendLayer::Tile t = { blendStacks[k].
i, blendStacks[k].j, (
u8)blendStacks[k].blends.back().m_TileMask };
233 blendLayers.back().m_Tiles.push_back(t);
234 blendStacks[k].blends.pop_back();
245 size_t bestStackSize = 0;
247 for (
size_t k = 0; k < blendStacks.size(); ++k)
249 if (blendStacks[k].blends.size() > bestStackSize)
251 bestStackSize = blendStacks[k].blends.size();
252 bestTex = blendStacks[k].blends.back().m_Texture;
257 if (bestStackSize == 0)
264 blendLayers.push_back(layer);
270 for (
size_t k = 0; k < blendLayers.size(); ++k)
274 splat.
m_Texture = blendLayers[k].m_Texture;
276 for (
size_t t = 0; t < blendLayers[k].m_Tiles.size(); ++t)
298 if (blendVertices.size())
306 for (
size_t k = 0; k < blendIndices.size(); ++k)
324 for (
size_t m = 0; m < 8; ++m)
325 shape8[m] = (shape & (1 << m)) ? 0 : 1;
328 unsigned int alphamapflags;
335 float u0 = texture->
m_TerrainAlpha->second.m_AlphaMapCoords[alphamap].u0;
336 float u1 = texture->
m_TerrainAlpha->second.m_AlphaMapCoords[alphamap].u1;
337 float v0 = texture->
m_TerrainAlpha->second.m_AlphaMapCoords[alphamap].v0;
338 float v1 = texture->
m_TerrainAlpha->second.m_AlphaMapCoords[alphamap].v1;
355 vtx[(base + 0) % 4].m_AlphaUVs[0] = u0;
356 vtx[(base + 0) % 4].m_AlphaUVs[1] = v0;
357 vtx[(base + 1) % 4].m_AlphaUVs[0] = u1;
358 vtx[(base + 1) % 4].m_AlphaUVs[1] = v0;
359 vtx[(base + 2) % 4].m_AlphaUVs[0] = u1;
360 vtx[(base + 2) % 4].m_AlphaUVs[1] = v1;
361 vtx[(base + 3) % 4].m_AlphaUVs[0] = u0;
362 vtx[(base + 3) % 4].m_AlphaUVs[1] = v1;
371 size_t index = blendVertices.size();
375 dst.m_Normal = normal;
379 blendVertices.push_back(dst);
383 dst.m_Normal = normal;
387 blendVertices.push_back(dst);
391 dst.m_Normal = normal;
395 blendVertices.push_back(dst);
399 dst.m_Normal = normal;
403 blendVertices.push_back(dst);
408 blendIndices.push_back(index+0);
409 blendIndices.push_back(index+1);
410 blendIndices.push_back(index+3);
412 blendIndices.push_back(index+1);
413 blendIndices.push_back(index+2);
414 blendIndices.push_back(index+3);
418 blendIndices.push_back(index+0);
419 blendIndices.push_back(index+1);
420 blendIndices.push_back(index+2);
422 blendIndices.push_back(index+2);
423 blendIndices.push_back(index+3);
424 blendIndices.push_back(index+0);
443 std::vector<unsigned short> indices;
450 std::vector<CTerrainTextureEntry*> textures;
456 if (std::find(textures.begin(),textures.end(),tex)==textures.end()) {
457 textures.push_back(tex);
466 ENSURE(base + vsize*vsize < 65536);
467 for (
size_t i=0;i<
m_Splats.size();i++) {
478 if (texgrid[j][i] == tex)
483 indices.push_back(
u16(((j+0)*vsize+(i+0))+base));
484 indices.push_back(
u16(((j+0)*vsize+(i+1))+base));
485 indices.push_back(
u16(((j+1)*vsize+(i+0))+base));
487 indices.push_back(
u16(((j+0)*vsize+(i+1))+base));
488 indices.push_back(
u16(((j+1)*vsize+(i+1))+base));
489 indices.push_back(
u16(((j+1)*vsize+(i+0))+base));
493 indices.push_back(
u16(((j+0)*vsize+(i+0))+base));
494 indices.push_back(
u16(((j+0)*vsize+(i+1))+base));
495 indices.push_back(
u16(((j+1)*vsize+(i+1))+base));
497 indices.push_back(
u16(((j+1)*vsize+(i+1))+base));
498 indices.push_back(
u16(((j+1)*vsize+(i+0))+base));
499 indices.push_back(
u16(((j+0)*vsize+(i+0))+base));
531 std::vector<SBaseVertex> vertices;
532 vertices.resize(vsize*vsize);
544 for (
ssize_t j=0;j<vsize;j++) {
545 for (
ssize_t i=0;i<vsize;i++) {
559 vertices[v].m_Normal = normal;
578 for (
ssize_t k = 0; k < vsize; k++)
594 float waterHeight = 0.f;
597 pos.
Y = std::max(pos.
Y, waterHeight);
606 if (k == 0 && !vertices.empty())
608 vertices.push_back(vertices.back());
609 vertices.push_back(v1);
613 vertices.push_back(v1);
614 vertices.push_back(v0);
622 std::vector<SSideVertex> sideVertices;
634 BuildSide(sideVertices, CPATCH_SIDE_NEGX);
637 BuildSide(sideVertices, CPATCH_SIDE_POSX);
640 BuildSide(sideVertices, CPATCH_SIDE_NEGZ);
643 BuildSide(sideVertices, CPATCH_SIDE_POSZ);
645 if (sideVertices.empty())
686 #define POOLED_BATCH_MAP(Key, Value) \
687 std::map<Key, Value, std::less<Key>, ProxyAllocator<std::pair<Key const, Value>, Allocators::DynamicArena > >
694 return m.insert(std::make_pair(k,
695 typename M::mapped_type(
typename M::mapped_type::key_compare(),
typename M::mapped_type::allocator_type(arena))
703 return m.insert(std::make_pair(k, std::make_pair(
704 typename M::mapped_type::first_type(
typename M::mapped_type::first_type::allocator_type(arena)),
705 typename M::mapped_type::second_type(
typename M::mapped_type::second_type::allocator_type(arena))
710 typedef std::pair<std::vector<GLint, ProxyAllocator<GLint, Allocators::DynamicArena > >, std::vector<void*, ProxyAllocator<void*, Allocators::DynamicArena > > >
BatchElements;
726 TextureBatches batches (TextureBatches::key_compare(), (TextureBatches::allocator_type(arena)));
731 for (
size_t i = 0; i < patches.size(); ++i)
734 for (
size_t j = 0; j < patch->
m_Splats.size(); ++j)
756 for (TextureBatches::iterator itt = batches.begin(); itt != batches.end(); ++itt)
764 if (itt->first->GetMaterial().GetShaderEffect().length() == 0)
766 LOGERROR(L
"Terrain renderer failed to load shader effect.\n");
770 techBase =
g_Renderer.GetShaderManager().LoadEffect(itt->first->GetMaterial().GetShaderEffect(),
771 context, itt->first->GetMaterial().GetShaderDefines(0));
773 numPasses = techBase->GetNumPasses();
776 for (
int pass = 0; pass < numPasses; ++pass)
780 techBase->BeginPass(pass);
784 const CShaderProgramPtr& shader = isDummyShader ? dummy : techBase->GetShader(pass);
786 if (itt->first->GetMaterial().GetSamplers().size() != 0)
789 size_t samplersNum = samplers.size();
791 for (
size_t s = 0; s < samplersNum; ++s)
797 itt->first->GetMaterial().GetStaticUniforms().BindUniforms(shader);
802 glMatrixMode(GL_TEXTURE);
803 glLoadMatrixf(itt->first->GetTextureMatrix());
804 glMatrixMode(GL_MODELVIEW);
809 float c = itt->first->GetTextureMatrix()[0];
810 float ms = itt->first->GetTextureMatrix()[8];
811 shader->Uniform(str_textureTransform, c, ms, -ms, 0.f);
816 shader->BindTexture(str_baseTex,
g_Renderer.GetTextureManager().GetErrorTexture());
819 for (VertexBufferBatches::iterator itv = itt->second.begin(); itv != itt->second.end(); ++itv)
823 shader->VertexPointer(3, GL_FLOAT, stride, &base->
m_Position[0]);
824 shader->ColorPointer(4, GL_UNSIGNED_BYTE, stride, &base->
m_DiffuseColor);
825 shader->NormalPointer(GL_FLOAT, stride, &base->
m_Normal[0]);
826 shader->TexCoordPointer(GL_TEXTURE0, 3, GL_FLOAT, stride, &base->
m_Position[0]);
828 shader->AssertPointersBound();
830 for (IndexBufferBatches::iterator it = itv->second.begin(); it != itv->second.end(); ++it)
841 for (
size_t i = 0; i < batch.first.size(); ++i)
842 glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
846 g_Renderer.m_Stats.m_TerrainTris += std::accumulate(batch.first.begin(), batch.first.end(), 0) / 3;
858 glMatrixMode(GL_TEXTURE);
860 glMatrixMode(GL_MODELVIEW);
873 m_Batches(VertexBufferBatches::key_compare(), VertexBufferBatches::allocator_type(arena))
892 typedef std::vector<CPatchRData::SSplat, ProxyAllocator<CPatchRData::SSplat, Allocators::DynamicArena > >
SplatStack;
903 typedef std::vector<SBlendBatch, ProxyAllocator<SBlendBatch, Allocators::DynamicArena > > BatchesStack;
904 BatchesStack batches((BatchesStack::allocator_type(arena)));
907 contextBlend.
Add(str_BLEND, str_1);
913 batches.reserve(256);
915 typedef std::vector<SBlendStackItem, ProxyAllocator<SBlendStackItem, Allocators::DynamicArena > > BlendStacks;
916 BlendStacks blendStacks((BlendStacks::allocator_type(arena)));
917 blendStacks.reserve(patches.size());
920 for (
size_t i = 0; i < patches.size(); ++i)
928 std::reverse(blendStacks.back().splats.begin(), blendStacks.back().splats.end());
939 if (!batches.empty())
943 for (
size_t k = 0; k < blendStacks.size(); ++k)
946 if (!splats.empty() && splats.back().m_Texture == tex)
952 batch.first.push_back(splats.back().m_IndexCount);
955 batch.second.push_back(indexBase +
sizeof(
u16)*(indices->
m_Index + splats.back().m_IndexStart));
963 size_t bestStackSize = 0;
965 for (
size_t k = 0; k < blendStacks.size(); ++k)
968 if (splats.size() > bestStackSize)
970 bestStackSize = splats.size();
971 bestTex = splats.back().m_Texture;
975 if (bestStackSize == 0)
980 batches.push_back(layer);
987 for (BatchesStack::iterator itt = batches.begin(); itt != batches.end(); ++itt)
989 if (itt->m_Texture->GetMaterial().GetSamplers().size() == 0)
997 techBase =
g_Renderer.GetShaderManager().LoadEffect(itt->m_Texture->GetMaterial().GetShaderEffect(), contextBlend, itt->m_Texture->GetMaterial().GetShaderDefines(0));
999 numPasses = techBase->GetNumPasses();
1003 for (
int pass = 0; pass < numPasses; ++pass)
1007 techBase->BeginPass(pass);
1011 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1014 const CShaderProgramPtr& shader = isDummyShader ? dummy : techBase->GetShader(pass);
1019 size_t samplersNum = samplers.size();
1021 for (
size_t s = 0; s < samplersNum; ++s)
1027 shader->BindTexture(str_blendTex, itt->m_Texture->m_TerrainAlpha->second.m_hCompositeAlphaMap);
1029 itt->m_Texture->GetMaterial().GetStaticUniforms().BindUniforms(shader);
1034 pglClientActiveTextureARB(GL_TEXTURE0);
1035 glMatrixMode(GL_TEXTURE);
1036 glLoadMatrixf(itt->m_Texture->GetTextureMatrix());
1037 glMatrixMode(GL_MODELVIEW);
1042 float c = itt->m_Texture->GetTextureMatrix()[0];
1043 float ms = itt->m_Texture->GetTextureMatrix()[8];
1044 shader->Uniform(str_textureTransform, c, ms, -ms, 0.f);
1049 shader->BindTexture(str_baseTex,
g_Renderer.GetTextureManager().GetErrorTexture());
1052 for (VertexBufferBatches::iterator itv = itt->m_Batches.begin(); itv != itt->m_Batches.end(); ++itv)
1055 if (itv->first != lastVB || shader != previousShader)
1057 lastVB = itv->first;
1058 previousShader = shader;
1062 shader->VertexPointer(3, GL_FLOAT, stride, &base->
m_Position[0]);
1063 shader->ColorPointer(4, GL_UNSIGNED_BYTE, stride, &base->
m_DiffuseColor);
1064 shader->NormalPointer(GL_FLOAT, stride, &base->
m_Normal[0]);
1065 shader->TexCoordPointer(GL_TEXTURE0, 3, GL_FLOAT, stride, &base->
m_Position[0]);
1066 shader->TexCoordPointer(GL_TEXTURE1, 2, GL_FLOAT, stride, &base->
m_AlphaUVs[0]);
1069 shader->AssertPointersBound();
1071 for (IndexBufferBatches::iterator it = itv->second.begin(); it != itv->second.end(); ++it)
1079 for (
size_t i = 0; i < batch.first.size(); ++i)
1080 glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
1085 g_Renderer.m_Stats.m_TerrainTris += std::accumulate(batch.first.begin(), batch.first.end(), 0) / 3;
1091 glDisable(GL_BLEND);
1092 techBase->EndPass();
1100 pglClientActiveTextureARB(GL_TEXTURE0);
1101 glMatrixMode(GL_TEXTURE);
1103 glMatrixMode(GL_MODELVIEW);
1113 typedef std::pair<std::vector<GLint>, std::vector<void*> >
BatchElements;
1116 typedef std::map<CVertexBuffer*, BatchElements> IndexBufferBatches;
1119 typedef std::map<CVertexBuffer*, IndexBufferBatches> VertexBufferBatches;
1121 VertexBufferBatches batches;
1126 for (
size_t i = 0; i < patches.size(); ++i)
1142 for (VertexBufferBatches::iterator itv = batches.begin(); itv != batches.end(); ++itv)
1147 shader->VertexPointer(3, GL_FLOAT, stride, &base->
m_Position);
1149 shader->TexCoordPointer(GL_TEXTURE0, 3, GL_FLOAT, stride, &base->
m_Position);
1151 shader->TexCoordPointer(GL_TEXTURE1, 3, GL_FLOAT, stride, &base->
m_Position);
1153 shader->ColorPointer(4, GL_UNSIGNED_BYTE, stride, &base->
m_DiffuseColor);
1155 shader->AssertPointersBound();
1157 for (IndexBufferBatches::iterator it = itv->second.begin(); it != itv->second.end(); ++it)
1161 BatchElements& batch = it->second;
1165 for (
size_t i = 0; i < batch.first.size(); ++i)
1166 glDrawElements(GL_TRIANGLES, batch.first[i], GL_UNSIGNED_SHORT, batch.second[i]);
1170 g_Renderer.m_Stats.m_TerrainTris += std::accumulate(batch.first.begin(), batch.first.end(), 0) / 3;
1184 std::vector<CVector3D> line;
1191 line.push_back(pos);
1196 line.push_back(pos);
1201 line.push_back(pos);
1206 line.push_back(pos);
1210 #warning TODO: implement CPatchRData::RenderOutlines for GLES
1212 glVertexPointer(3, GL_FLOAT,
sizeof(
CVector3D), &line[0]);
1213 glDrawArrays(GL_LINE_STRIP, 0, line.size());
1228 shader->VertexPointer(3, GL_FLOAT, stride, &base->
m_Position);
1230 shader->AssertPointersBound();
1296 if (!cmpWaterManager)
1300 std::vector<SWaterVertex> water_vertex_data;
1301 std::vector<GLushort> water_indices;
1303 memset(water_index_map, 0xFF,
sizeof(water_index_map));
1329 if (startTerrainHeight[0] >= startWaterHeight[0] && startTerrainHeight[1] >= startWaterHeight[1])
1333 bool belowWater =
true;
1342 if (terrainHeight[0] >= waterHeight[0] && terrainHeight[1] >= waterHeight[1])
1354 for (
int j = 0; j < 2; j++)
1357 if (water_index_map[z+j*water_cell_size][x] != 0xFFFF)
1363 float depth = waterHeight[j] - vertex.
m_Position.
Y;
1374 float depthInt = floor(depth);
1375 float depthFrac = depth - depthInt;
1377 u8(
clamp(depthInt, 0.0f, 255.0f)),
1378 u8(
clamp(-depthInt, 0.0f, 255.0f)),
1379 u8(
clamp(depthFrac*255.0f, 0.0f, 255.0f)),
1380 u8(
clamp(alpha*255.0f, 0.0f, 255.0f)));
1386 WaterMgr->
m_WaveZ[tx + ty*mapSize],
1391 water_vertex_data.push_back(vertex);
1397 if (x <= stripStart)
1400 water_indices.push_back(water_index_map[z + water_cell_size][x - water_cell_size]);
1401 water_indices.push_back(water_index_map[z][x - water_cell_size]);
1402 water_indices.push_back(water_index_map[z][x]);
1403 water_indices.push_back(water_index_map[z + water_cell_size][x]);
1409 if (water_indices.size() == 0)
1436 shader->AssertPointersBound();
1443 #warning TODO: fix CPatchRData::RenderWater for GLES (avoid GL_QUADS)
#define BLENDMAP_ROTATE90
static const ssize_t water_cell_size
void Add(CStrIntern name, CStrIntern value)
Add a name and associated value to the map of defines.
size_t m_Index
Start index of this chunk in owner.
CTerrainTextureEntry * GetTextureEntry()
friend struct SBlendStackItem
void PrintfAt(float x, float y, const wchar_t *fmt,...)
Print formatted text at (x,y) under the current transform.
void RenderWater(CShaderProgramPtr &shader)
std::vector< CPatchRData::SSplat, ProxyAllocator< CPatchRData::SSplat, Allocators::DynamicArena > > SplatStack
CBoundingBoxAligned m_WaterBounds
VertexBufferBatches m_Batches
const ssize_t TERRAIN_TILE_SIZE
metres [world space units] per tile in x and z
CTerrainTextureEntry * m_Texture
CVertexBufferManager g_VBMan
CTerrainTextureEntry * m_Texture
Represents the ordered collection of blends drawn on a particular tile.
static void swap(UniqueRange &p1, UniqueRange &p2)
SColor4ub EvaluateTerrainDiffuseScaled(const CVector3D &normal) const
Compute the diffuse sun lighting color on terrain, for rendering with CPU lighting.
void CalcPosition(ssize_t i, ssize_t j, CVector3D &pos) const
ssize_t GetVerticesPerSide() const
bool GetTriangulationDir(ssize_t i, ssize_t j) const
std::vector< STileBlend > blends
M::mapped_type & PooledMapGet(M &m, const typename M::key_type &k, Allocators::DynamicArena &arena)
bool operator()(const STileBlend &a, const STileBlend &b) const
shared_ptr< CShaderTechnique > CShaderTechniquePtr
Represents a batched collection of blends using the same texture.
#define ASSERT(expr)
same as ENSURE in debug mode, does nothing in release mode.
CPatchRData(CPatch *patch, CSimulation2 *simulation)
Class ShadowMap: Maintain the shadow map texture and perform necessary OpenGL setup, including matrix calculations.
#define PROFILE_END(name)
Represents a blend for a single tile, texture and shape.
u8 * Bind()
Bind to this buffer; return pointer to address required as parameter to glVertexPointer ( + etc) call...
CVertexBuffer::VBChunk * m_VBWaterIndices
VBChunk: describes a portion of this vertex buffer.
CVertexBuffer::VBChunk * m_VBBlends
void AddBlend(std::vector< SBlendVertex > &blendVertices, std::vector< u16 > &blendIndices, u16 i, u16 j, u8 shape, CTerrainTextureEntry *texture)
std::pair< std::vector< GLint, ProxyAllocator< GLint, Allocators::DynamicArena > >, std::vector< void *, ProxyAllocator< void *, Allocators::DynamicArena > > > BatchElements
const entity_id_t SYSTEM_ENTITY
Entity ID for singleton 'system' components.
Public API for simulation system.
CVertexBuffer: encapsulation of ARB_vertex_buffer_object, also supplying some additional functionalit...
u8 * GetBindAddress()
Get the address that Bind() will return, without actually binding.
void CalcNormal(ssize_t i, ssize_t j, CVector3D &normal) const
CVertexBuffer::VBChunk * indices
void BuildSide(std::vector< SSideVertex > &vertices, CPatchSideFlags side)
std::vector< SSplat > m_BlendSplats
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
#define POOLED_BATCH_MAP(Key, Value)
M::mapped_type & PooledPairGet(M &m, const typename M::key_type &k, Allocators::DynamicArena &arena)
CVertexBuffer::VBChunk * Allocate(size_t vertexSize, size_t numVertices, GLenum usage, GLenum target)
Try to allocate a vertex buffer of the given size and type.
Helper structure for RenderBlends.
std::vector< Tile > m_Tiles
void Update(CSimulation2 *simulation)
CMiniPatch * GetTile(ssize_t i, ssize_t j) const
virtual float GetExactWaterLevel(float x, float z)=0
Get the current water level at the given point.
SBlendBatch(Allocators::DynamicArena &arena)
#define PROFILE_START(name)
CGame * g_Game
Globally accessible pointer to the CGame object.
void UpdateChunkVertices(VBChunk *chunk, void *data)
Update vertex data for given chunk. Transfers the provided data to the actual OpenGL vertex buffer...
void GetScreenCoordinates(const CVector3D &world, float &x, float &y) const
CTerrainTextureEntry * m_Texture
void RenderSides(CShaderProgramPtr &shader)
const ssize_t BlendOffsets[9][2]
A simplified syntax for accessing entity components.
size_t m_Count
Number of vertices used by chunk.
static void RenderBlends(const std::vector< CPatchRData * > &patches, const CShaderDefines &context, ShadowMap *shadow, bool isDummyShader=false, const CShaderProgramPtr &dummy=CShaderProgramPtr())
Represents a mapping of name strings to value strings, for use with #if and #ifdef and similar condit...
int Calculate(BlendShape8 shape, unsigned int &flags)
void CreateSuperfancyInfo(CSimulation2 *simulation)
CreateSuperfancyInfo: creates textures and wave vertices for superfancy water.
CGameView * GetView()
Get the pointer to the game view object.
void Release(CVertexBuffer::VBChunk *chunk)
Returns the given chunk to its owning buffer.
CVertexBuffer::VBChunk * vertices
SBlendStackItem(CVertexBuffer::VBChunk *v, CVertexBuffer::VBChunk *i, const std::vector< CPatchRData::SSplat > &s, Allocators::DynamicArena &arena)
CVertexBuffer::VBChunk * m_VBBase
CTerrainTextureEntry * m_Texture
static void PrepareShader(const CShaderProgramPtr &shader, ShadowMap *shadow)
Set up all the uniforms for a shader pass.
CVertexBuffer::VBChunk * m_VBBlendIndices
std::vector< SSplat > m_Splats
void RenderPriorities(CTextRenderer &textRenderer)
CVertexBuffer * m_Owner
Owning (parent) vertex buffer.
float GetVertexGroundLevel(ssize_t i, ssize_t j) const
CVertexBuffer::VBChunk * m_VBSides
CSimulation2 * m_Simulation
std::vector< TextureSampler > SamplersVector
CMiniPatch m_MiniPatches[PATCH_SIZE][PATCH_SIZE]
allocator design parameters:
#define BLENDMAP_ROTATE270
CVertexBuffer::VBChunk * m_VBWater
SColor4ub EvaluateTerrainDiffuseFactor(const CVector3D &normal) const
Compute the diffuse sun lighting factor on terrain, for rendering with shader lighting.
#define BLENDMAP_ROTATE180
static void Unbind()
Unbind any currently-bound buffer, so glVertexPointer etc calls will not attempt to use it...
CVertexBuffer::VBChunk * m_VBBaseIndices
Class CLightEnv: description of a lighting environment - contains all the necessary parameters for re...
float * m_DistanceToShore
static void RenderStreams(const std::vector< CPatchRData * > &patches, const CShaderProgramPtr &shader, int streamflags)
Helper structure for RenderBlends.
shared_ptr< CShaderProgram > CShaderProgramPtr
CTerrainTextureManager::TerrainAlphaMap::iterator m_TerrainAlpha
T clamp(T value, T min, T max)
bool operator()(const STileBlend &a) const
Class WaterManager: Maintain water settings and textures.