Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 364 vs 365 for /trunk/Source Code/Environment/Terrain/Terrain.cpp

Diff revisions: vs.
  @@ -17,7 +17,7 @@
17 17 namespace Divide {
18 18
19 19 Terrain::Terrain()
20 - : Object3D(TERRAIN),
20 + : Object3D(ObjectType::TERRAIN, ObjectFlag::OBJECT_FLAG_NONE),
21 21 _alphaTexturePresent(false),
22 22 _plane(nullptr),
23 23 _drawBBoxes(false),
  @@ -27,17 +27,18 @@
27 27 _terrainDepthRenderStateHash(0),
28 28 _terrainReflectionRenderStateHash(0),
29 29 _terrainInView(false),
30 - _planeInView(false) {
30 + _planeInView(false)
31 + {
31 32 getGeometryVB()->useLargeIndices(true); //<32bit indices
32 33
33 34 _albedoSampler = MemoryManager_NEW SamplerDescriptor();
34 - _albedoSampler->setWrapMode(TEXTURE_REPEAT);
35 + _albedoSampler->setWrapMode(TextureWrap::TEXTURE_REPEAT);
35 36 _albedoSampler->setAnisotropy(8);
36 37 _albedoSampler->toggleMipMaps(true);
37 38 _albedoSampler->toggleSRGBColorSpace(true);
38 39
39 40 _normalSampler = MemoryManager_NEW SamplerDescriptor();
40 - _normalSampler->setWrapMode(TEXTURE_REPEAT);
41 + _normalSampler->setWrapMode(TextureWrap::TEXTURE_REPEAT);
41 42 _normalSampler->setAnisotropy(8);
42 43 _normalSampler->toggleMipMaps(true);
43 44 }
  @@ -78,8 +79,8 @@
78 79 for (U8 i = 0; i < 3; ++i) {
79 80 ShaderProgram* const drawShader =
80 81 mat->getShaderInfo(i == 0
81 - ? FINAL_STAGE
82 - : (i == 1 ? SHADOW_STAGE : Z_PRE_PASS_STAGE))
82 + ? RenderStage::FINAL_STAGE
83 + : (i == 1 ? RenderStage::SHADOW_STAGE : RenderStage::Z_PRE_PASS_STAGE))
83 84 .getProgram();
84 85 drawShader->Uniform("dvd_waterHeight",
85 86 GET_ACTIVE_SCENE()->state().getWaterLevel());
  @@ -152,12 +153,12 @@
152 153 vectorImpl<GenericDrawCommand>& drawCommandsOut) {
153 154 size_t drawStateHash = 0;
154 155
155 - if (bitCompare(currentRenderStage, DEPTH_STAGE)) {
156 - drawStateHash = bitCompare(currentRenderStage, Z_PRE_PASS_STAGE)
156 + if (currentRenderStage == RenderStage::DEPTH_STAGE) {
157 + drawStateHash = currentRenderStage == RenderStage::Z_PRE_PASS_STAGE
157 158 ? _terrainRenderStateHash
158 159 : _terrainDepthRenderStateHash;
159 160 } else {
160 - drawStateHash = bitCompare(currentRenderStage, REFLECTION_STAGE)
161 + drawStateHash = currentRenderStage == RenderStage::REFLECTION_STAGE
161 162 ? _terrainReflectionRenderStateHash
162 163 : _terrainRenderStateHash;
163 164 }
  @@ -167,8 +168,8 @@
167 168 assert(renderable != nullptr);
168 169
169 170 ShaderProgram* drawShader = renderable->getDrawShader(
170 - bitCompare(currentRenderStage, REFLECTION_STAGE) ? FINAL_STAGE
171 - : currentRenderStage);
171 + currentRenderStage == RenderStage::REFLECTION_STAGE ? RenderStage::FINAL_STAGE
172 + : currentRenderStage);
172 173
173 174 if (_terrainInView) {
174 175 vectorImpl<GenericDrawCommand> tempCommands;
  @@ -192,9 +193,10 @@
192 193 }
193 194
194 195 // draw infinite plane
195 - if (GFX_DEVICE.isCurrentRenderStage(FINAL_STAGE | Z_PRE_PASS_STAGE) &&
196 + if (GFX_DEVICE.isCurrentRenderStage(enum_to_uint(RenderStage::FINAL_STAGE) |
197 + enum_to_uint(RenderStage::Z_PRE_PASS_STAGE)) &&
196 198 _planeInView) {
197 - GenericDrawCommand cmd(TRIANGLE_STRIP, 0, 1);
199 + GenericDrawCommand cmd(PrimitiveType::TRIANGLE_STRIP, 0, 1);
198 200 cmd.renderWireframe(renderable->renderWireframe());
199 201 cmd.stateHash(drawStateHash);
200 202 cmd.shaderProgram(drawShader);