Browse Source

Added a UI to terrain test for toggling various options.
Minor fix to allow padding to be declared within containers in .form files.

Steve Grenier 13 years ago
parent
commit
c7e8050a2a
2 changed files with 6 additions and 4 deletions
  1. 3 1
      gameplay/src/Container.cpp
  2. 3 3
      gameplay/src/TerrainPatch.cpp

+ 3 - 1
gameplay/src/Container.cpp

@@ -167,7 +167,9 @@ void Container::addControls(Theme* theme, Properties* properties)
         }
         }
         else
         else
         {
         {
-            GP_ERROR("Failed to create control; unrecognized control name '%s'.", controlName.c_str());
+            // Ignore - not a valid control name.
+            // This used to fail, but I see no reason to hard fail here (this also fixes not being able
+            // to set padding on containers).
         }
         }
 
 
         // Add the new control to the form.
         // Add the new control to the form.

+ 3 - 3
gameplay/src/TerrainPatch.cpp

@@ -482,15 +482,15 @@ bool TerrainPatch::updateMaterial()
 
 
         // Set material parameter bindings
         // Set material parameter bindings
         material->getParameter("u_worldViewProjectionMatrix")->bindValue(_terrain, &Terrain::getWorldViewProjectionMatrix);
         material->getParameter("u_worldViewProjectionMatrix")->bindValue(_terrain, &Terrain::getWorldViewProjectionMatrix);
-        if (!_terrain->_normalMap)
+        if (_terrain->_normalMap)
+            material->getParameter("u_normalMap")->setValue(_terrain->_normalMap);
+        else
             material->getParameter("u_normalMatrix")->bindValue(_terrain, &Terrain::getNormalMatrix);
             material->getParameter("u_normalMatrix")->bindValue(_terrain, &Terrain::getNormalMatrix);
         material->getParameter("u_ambientColor")->bindValue(this, &TerrainPatch::getAmbientColor);
         material->getParameter("u_ambientColor")->bindValue(this, &TerrainPatch::getAmbientColor);
         material->getParameter("u_lightColor")->bindValue(this, &TerrainPatch::getLightColor);
         material->getParameter("u_lightColor")->bindValue(this, &TerrainPatch::getLightColor);
         material->getParameter("u_lightDirection")->bindValue(this, &TerrainPatch::getLightDirection);
         material->getParameter("u_lightDirection")->bindValue(this, &TerrainPatch::getLightDirection);
         if (_layers.size() > 0)
         if (_layers.size() > 0)
             material->getParameter("u_samplers")->setValue((const Texture::Sampler**)&_samplers[0], (unsigned int)_samplers.size());
             material->getParameter("u_samplers")->setValue((const Texture::Sampler**)&_samplers[0], (unsigned int)_samplers.size());
-        if (_terrain->_normalMap)
-            material->getParameter("u_normalMap")->setValue(_terrain->_normalMap);
 
 
         if (_terrain->isFlagSet(Terrain::DEBUG_PATCHES))
         if (_terrain->isFlagSet(Terrain::DEBUG_PATCHES))
         {
         {