Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 276 vs 286 for /trunk/Source Code/Environment/Terrain/TerrainLoader.cpp

Diff revisions: vs.
  @@ -21,26 +21,6 @@
21 21 bool TerrainLoader::loadTerrain(Terrain* terrain, TerrainDescriptor* terrainDescriptor){
22 22 const std::string& name = terrainDescriptor->getVariable("terrainName");
23 23
24 - Texture* tempTexture = nullptr;
25 -
26 - ResourceDescriptor textureWaterCaustics("Terrain Water Caustics_" + name);
27 - textureWaterCaustics.setResourceLocation(terrainDescriptor->getVariable("waterCaustics"));
28 - textureWaterCaustics.setPropertyDescriptor(*_textureSampler);
29 - tempTexture = CreateResource<Texture>(textureWaterCaustics);
30 - terrain->setCausticsTex(tempTexture);
31 -
32 - ResourceDescriptor underwaterAlbedoTexture("Terrain Underwater Albedo_" + name);
33 - underwaterAlbedoTexture.setResourceLocation(terrainDescriptor->getVariable("underwaterAlbedoTexture"));
34 - underwaterAlbedoTexture.setPropertyDescriptor(*_textureSampler);
35 - tempTexture = CreateResource<Texture>(underwaterAlbedoTexture);
36 - terrain->setUnderwaterAlbedoTex(tempTexture);
37 -
38 - ResourceDescriptor underwaterDetailTexture("Terrain Underwater Detail_" + name);
39 - underwaterDetailTexture.setResourceLocation(terrainDescriptor->getVariable("underwaterDetailTexture"));
40 - underwaterDetailTexture.setPropertyDescriptor(*_textureSampler);
41 - tempTexture = CreateResource<Texture>(underwaterDetailTexture);
42 - terrain->setUnderwaterDetailTex(tempTexture);
43 -
44 24 terrain->setUnderwaterDiffuseScale(terrainDescriptor->getVariablef("underwaterDiffuseScale"));
45 25
46 26 SamplerDescriptor blendMapSampler;
  @@ -134,8 +114,8 @@
134 114 ResourceDescriptor terrainMaterialDescriptor("terrainMaterial_" + name);
135 115 Material* terrainMaterial = CreateResource<Material>(terrainMaterialDescriptor);
136 116
137 - terrainMaterial->setDiffuse(DefaultColors::WHITE() / 2);
138 - terrainMaterial->setAmbient(DefaultColors::WHITE() / 3);
117 + terrainMaterial->setDiffuse(vec4<F32>(DefaultColors::WHITE().rgb() / 2, 1.0f));
118 + terrainMaterial->setAmbient(vec4<F32>(DefaultColors::WHITE().rgb() / 3, 1.0f));
139 119 terrainMaterial->setSpecular(vec4<F32>(0.1f, 0.1f, 0.1f, 1.0f));
140 120 terrainMaterial->setShininess(20.0f);
141 121 terrainMaterial->addShaderDefines("COMPUTE_TBN");
  @@ -145,6 +125,22 @@
145 125 terrainMaterial->setShaderProgram("terrain", FINAL_STAGE, true);
146 126 terrainMaterial->setShaderProgram("depthPass.Shadow.Terrain", SHADOW_STAGE, true);
147 127 terrainMaterial->setShaderProgram("depthPass.PrePass.Terrain", Z_PRE_PASS_STAGE, true);
128 +
129 + ResourceDescriptor textureWaterCaustics("Terrain Water Caustics_" + name);
130 + textureWaterCaustics.setResourceLocation(terrainDescriptor->getVariable("waterCaustics"));
131 + textureWaterCaustics.setPropertyDescriptor(*_textureSampler);
132 + terrainMaterial->setTexture(Material::TEXTURE_UNIT0, CreateResource<Texture>(textureWaterCaustics));
133 +
134 + ResourceDescriptor underwaterAlbedoTexture("Terrain Underwater Albedo_" + name);
135 + underwaterAlbedoTexture.setResourceLocation(terrainDescriptor->getVariable("underwaterAlbedoTexture"));
136 + underwaterAlbedoTexture.setPropertyDescriptor(*_textureSampler);
137 + terrainMaterial->setTexture(Material::TEXTURE_UNIT1, CreateResource<Texture>(underwaterAlbedoTexture));
138 +
139 + ResourceDescriptor underwaterDetailTexture("Terrain Underwater Detail_" + name);
140 + underwaterDetailTexture.setResourceLocation(terrainDescriptor->getVariable("underwaterDetailTexture"));
141 + underwaterDetailTexture.setPropertyDescriptor(*_textureSampler);
142 + terrainMaterial->setTexture(Material::TEXTURE_NORMALMAP, CreateResource<Texture>(underwaterDetailTexture));
143 +
148 144 terrainMaterial->setShaderLoadThreaded(false);
149 145 terrainMaterial->dumpToFile(false);
150 146 terrain->setMaterial(terrainMaterial);