Browse Source

Fix PSSM

master
C. J. Howard 6 years ago
parent
commit
120ca183a3
8 changed files with 148 additions and 309 deletions
  1. +1
    -1
      data
  2. +2
    -10
      src/application.cpp
  3. +0
    -1
      src/application.hpp
  4. +22
    -0
      src/camera-rig.cpp
  5. +24
    -7
      src/camera-rig.hpp
  6. +92
    -221
      src/render-passes.cpp
  7. +5
    -67
      src/render-passes.hpp
  8. +2
    -2
      src/states/game-state.cpp

+ 1
- 1
data

@ -1 +1 @@
Subproject commit 539e0fb8dd911630199af903257c8dfe7f70de9f
Subproject commit 802f027beb17f435976c1788b58e793d41a77fd5

+ 2
- 10
src/application.cpp View File

@ -909,9 +909,6 @@ bool Application::loadScene()
clearDepthPass.setClear(false, true, false);
clearDepthPass.setClearDepth(1.0f);
// Setup soil pass
soilPass.setRenderTarget(&framebufferARenderTarget);
// Setup lighting pass
lightingPass.setRenderTarget(&framebufferARenderTarget);
lightingPass.setShadowMap(shadowMapDepthTexture);
@ -938,7 +935,6 @@ bool Application::loadScene()
defaultCompositor.addPass(&clearDepthPass);
defaultCompositor.addPass(&skyboxPass);
//defaultCompositor.addPass(&soilPass);
defaultCompositor.addPass(&lightingPass);
defaultCompositor.addPass(&horizontalBlurPass);
defaultCompositor.addPass(&verticalBlurPass);
@ -948,7 +944,7 @@ bool Application::loadScene()
defaultCompositor.load(nullptr);
// Setup sunlight camera
sunlightCamera.lookAt(Vector3(0.5f, 2.0f, 2.0f), Vector3(0, 0, 0), Vector3(0, 1, 0));
sunlightCamera.lookAt(Vector3(0, 0, 0), -Vector3(0.5f, 2.0f, 2.0f), Vector3(0, 1, 0));
sunlightCamera.setOrthographic(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
sunlightCamera.setCompositor(&shadowMapCompositor);
sunlightCamera.setCompositeIndex(0);
@ -1637,7 +1633,7 @@ bool Application::loadGame()
lens = new Lens(lensModel);
lens->setOrbitCam(orbitCam);
lens->setSunDirection(glm::normalize(-sunlightCamera.getTranslation()));
lens->setSunDirection(glm::normalize(-Vector3(0.5f, 2.0f, 2.0f)));
brush = new Brush(brushModel);
brush->setColony(colony);
@ -2061,10 +2057,6 @@ void Application::loadWorld(std::size_t index)
const Biome* biome = &biosphere.biomes[levelParams->biome];
// Setup rendering passes
soilPass.setHorizonOTexture(biome->soilHorizonO);
soilPass.setHorizonATexture(biome->soilHorizonA);
soilPass.setHorizonBTexture(biome->soilHorizonB);
soilPass.setHorizonCTexture(biome->soilHorizonC);
lightingPass.setDiffuseCubemap(biome->diffuseCubemap);
lightingPass.setSpecularCubemap(biome->specularCubemap);
skyboxPass.setCubemap(biome->specularCubemap);

+ 0
- 1
src/application.hpp View File

@ -200,7 +200,6 @@ public:
Texture pheromoneTexture;
ClearRenderPass clearDepthPass;
SoilRenderPass soilPass;
LightingRenderPass lightingPass;
DebugRenderPass debugPass;
Compositor defaultCompositor;

+ 22
- 0
src/camera-rig.cpp View File

@ -227,3 +227,25 @@ void OrbitCam::setTargetAzimuth(float angle)
targetAzimuth = angle;
targetAzimuthRotation = glm::angleAxis(targetAzimuth, Vector3(0.0f, 1.0f, 0.0f));
}
ShadowCam::ShadowCam():
light(nullptr)
{}
ShadowCam::~ShadowCam()
{}
void ShadowCam::setLight(const PunctualLight* light)
{
this->light = light;
if (light != nullptr)
{
}
}
void ShadowCam::update(float dt)
{
}

+ 24
- 7
src/camera-rig.hpp View File

@ -183,7 +183,7 @@ public:
float getTargetElevation() const;
float getTargetAzimuth() const;
const Vector3& getTargetTranslation() const;
const glm::quat& getTargetRotation() const;
const Quaternion& getTargetRotation() const;
private:
Vector3 focalPoint;
@ -196,11 +196,11 @@ private:
float targetElevation;
float targetAzimuth;
glm::quat elevationRotation;
glm::quat azimuthRotation;
glm::quat targetElevationRotation;
glm::quat targetAzimuthRotation;
glm::quat targetRotation;
Quaternion elevationRotation;
Quaternion azimuthRotation;
Quaternion targetElevationRotation;
Quaternion targetAzimuthRotation;
Quaternion targetRotation;
Vector3 targetTranslation;
};
@ -249,9 +249,26 @@ inline const Vector3& OrbitCam::getTargetTranslation() const
return targetTranslation;
}
inline const glm::quat& OrbitCam::getTargetRotation() const
inline const Quaternion& OrbitCam::getTargetRotation() const
{
return targetRotation;
}
/**
* Rig which aligns a camera with a light. Used for rendering shadow maps.
*/
class ShadowCam
{
public:
ShadowCam();
virtual ~ShadowCam();
void setLight(const PunctualLight* light);
void update(float dt);
private:
const PunctualLight* light;
};
#endif // CAMERA_RIG_HPP

+ 92
- 221
src/render-passes.cpp View File

@ -204,6 +204,9 @@ bool ShadowMapRenderPass::load(const RenderContext* renderContext)
// Set number of frustum splits
frustumSplitCount = 4;
// Create array of split distances
splitDistances = new float[frustumSplitCount + 1];
// Create split view frustum
splitViewFrustum = new SplitViewFrustum(frustumSplitCount);
@ -278,6 +281,9 @@ void ShadowMapRenderPass::unload()
delete[] croppedShadowMapViewports;
croppedShadowMapViewports = nullptr;
delete[] splitDistances;
splitDistances = nullptr;
delete splitViewFrustum;
splitViewFrustum = nullptr;
@ -305,7 +311,7 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
glClear(GL_DEPTH_BUFFER_BIT);
// Draw front and back faces
glDisable(GL_CULL_FACE);
glEnable(GL_CULL_FACE);
// Disable alpha blending
glDisable(GL_BLEND);
@ -329,13 +335,12 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
center = center * 1.0f / static_cast<float>(viewFrustum.getCornerCount());
// Position light camera in center of view frustum
//lightCamera->lookAt(center, center + lightCamera->getForward(), lightCamera->getUp());
//lightCamera->lookAt(center, center + lightCamera->getForward(), Vector3(0, 1, 0));
// Calculate split distances
float clipNear = viewCamera->getClipNear();
float clipFar = viewCamera->getClipFar();
float* splitDistances = new float[frustumSplitCount + 1];
float splitSchemeWeight = 0.5f;
float splitSchemeWeight = 0.85f;
for (std::size_t i = 1; i < frustumSplitCount; ++i)
{
@ -357,29 +362,80 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
// For each frustum split
for (int i = 0; i < frustumSplitCount; ++i)
{
// Calculate crop matrix
{
ViewFrustum frustumSplit;
// Determine near and far distances for this subfrustum
float splitNear = splitDistances[0];
float splitFar = splitDistances[4];
float splitNear = splitDistances[i];
float splitFar = splitDistances[i + 1];
Matrix4 splitView = viewCamera->getView();
// Calculate subfrustum projection matrix
Matrix4 splitProjection = glm::ortho(viewCamera->getClipLeft(), viewCamera->getClipRight(), viewCamera->getClipBottom(), viewCamera->getClipTop(), splitNear, splitFar);
Matrix4 splitProjection = glm::ortho(lightCamera->getClipLeft(), lightCamera->getClipRight(), lightCamera->getClipBottom(), lightCamera->getClipTop(), splitNear, splitFar);
splitProjection = viewCamera->getProjection();
splitProjection[2][2] = -(splitFar + splitNear) / (splitFar - splitNear);
splitProjection[3][2] = -(2.0f * splitFar * splitNear) / (splitFar - splitNear);
// Set subfrustum matrices
frustumSplit.setMatrices(viewCamera->getView(), splitProjection);
frustumSplit.setMatrices(splitView, splitProjection);
// Create AABB containing the frustum split corners
AABB frustumSplitBounds(Vector3(std::numeric_limits<float>::infinity()), Vector3(-std::numeric_limits<float>::infinity()));
for (std::size_t j = 0; j < frustumSplit.getCornerCount(); ++j)
// Frustum corners in NDC-space
Vector3 splitCorners[8] =
{
Vector3(-1.0f, 1.0f, -1.0f),
Vector3( 1.0f, 1.0f, -1.0f),
Vector3(-1.0f, -1.0f, -1.0f),
Vector3( 1.0f, -1.0f, -1.0f),
Vector3(-1.0f, 1.0f, 1.0f),
Vector3( 1.0f, 1.0f, 1.0f),
Vector3(-1.0f, -1.0f, 1.0f),
Vector3( 1.0f, -1.0f, 1.0f)
};
Matrix4 splitInverseViewProjection = glm::inverse(frustumSplit.getViewProjectionMatrix());
for (int j = 0; j < 8; ++j)
{
Vector4 transformedCorner = splitInverseViewProjection * Vector4(splitCorners[j], 1.0f);
splitCorners[j] = Vector3(transformedCorner) / transformedCorner.w;
}
AABB frustumSplitBounds(splitCorners[0], splitCorners[0]);
for (std::size_t j = 1; j < 8; ++j)
{
frustumSplitBounds.add(frustumSplit.getCorner(j));
frustumSplitBounds.add(splitCorners[j]);
}
AABB croppingBounds(Vector3(std::numeric_limits<float>::infinity()), Vector3(-std::numeric_limits<float>::infinity()));
for (int j = 0; j < 8; ++j)
{
Vector3 minPoint = frustumSplitBounds.getMin();
Vector3 maxPoint = frustumSplitBounds.getMax();
Vector3 aabbCorners[8] =
{
minPoint,
Vector3(minPoint.x, minPoint.y, maxPoint.z),
Vector3(minPoint.x, maxPoint.y, minPoint.z),
Vector3(minPoint.x, maxPoint.y, maxPoint.z),
Vector3(maxPoint.x, minPoint.y, minPoint.z),
Vector3(maxPoint.x, minPoint.y, maxPoint.z),
Vector3(maxPoint.x, maxPoint.y, minPoint.z),
maxPoint
};
Vector4 transformedPoint = lightCamera->getViewProjection() * Vector4(aabbCorners[j], 1.0f);
croppingBounds.add(Vector3(transformedPoint / transformedPoint.w));
}
// Transform frustum split bounds into light's clip space
AABB croppingBounds = frustumSplitBounds.transformed(lightCamera->getViewProjection());
//AABB croppingBounds = frustumSplitBounds.transformed(lightCamera->getView());
Vector3 cropMax = croppingBounds.getMax();
Vector3 cropMin = croppingBounds.getMin();
//cropMin.z = 0.0f;
@ -391,9 +447,9 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
scale.z = 1.0f / (cropMax.z - cropMin.z);
// Quantize scale
//float scaleQuantizer = 64.0f;
//scale.x = 1.0f / std::ceil(1.0f / scale.x * scaleQuantizer) * scaleQuantizer;
//scale.y = 1.0f / std::ceil(1.0f / scale.y * scaleQuantizer) * scaleQuantizer;
float scaleQuantizer = 64.0f;
scale.x = 1.0f / std::ceil(1.0f / scale.x * scaleQuantizer) * scaleQuantizer;
scale.y = 1.0f / std::ceil(1.0f / scale.y * scaleQuantizer) * scaleQuantizer;
// Calculate offset
Vector3 offset;
@ -402,9 +458,9 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
offset.z = -cropMin.z * scale.z;
// Quantize offset
//float halfTextureSize = static_cast<float>(croppedShadowMapResolution) * 0.5f;
//offset.x = std::ceil(offset.x * halfTextureSize) / halfTextureSize;
//offset.y = std::ceil(offset.y * halfTextureSize) / halfTextureSize;
float halfTextureSize = static_cast<float>(croppedShadowMapResolution) * 0.5f;
offset.x = std::ceil(offset.x * halfTextureSize) / halfTextureSize;
offset.y = std::ceil(offset.y * halfTextureSize) / halfTextureSize;
cropMatrices[i] = glm::translate(offset) * glm::scale(scale);
}
@ -466,209 +522,9 @@ void ShadowMapRenderPass::render(RenderContext* renderContext)
}
}
delete[] splitDistances;
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
ClippingRenderPass::ClippingRenderPass():
shader(nullptr)
{
clippingPlanesParam = parameterSet.addParameter("clippingPlanes", ShaderParameter::Type::VECTOR_4, 1);
modelParam = parameterSet.addParameter("modelMatrix", ShaderParameter::Type::MATRIX_4, 1);
modelViewProjectionParam = parameterSet.addParameter("modelViewProjectionMatrix", ShaderParameter::Type::MATRIX_4, 1);
}
bool ClippingRenderPass::load(const RenderContext* renderContext)
{
shaderLoader.undefine();
shaderLoader.define("CLIPPING_PLANE_COUNT", 1);
shader = shaderLoader.load("data/shaders/clip.glsl", &parameterSet);
if (!shader)
{
return false;
}
return true;
}
void ClippingRenderPass::unload()
{
delete shader;
shader = nullptr;
}
void ClippingRenderPass::render(RenderContext* renderContext)
{
glEnable(GL_CLIP_DISTANCE0);
glEnable(GL_STENCIL_TEST);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
// Bind shader
shader->bind();
// Pass clipping planes to shader
shader->setParameter(clippingPlanesParam, clippingPlane);
// Grab render context parameters
const Camera& camera = *(renderContext->camera);
const std::list<RenderOperation>* operations = renderContext->queue->getOperations();
// Two passes
for (int i = 0; i < 2; ++i)
{
if (!i)
{
// Increment stencil for back faces
glStencilFunc(GL_ALWAYS, 0, 0);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
glCullFace(GL_FRONT);
}
else
{
// Decrement stencil for front faces
glStencilOp(GL_KEEP, GL_KEEP, GL_DECR);
glCullFace(GL_BACK);
}
for (const RenderOperation& operation: *operations)
{
const Matrix4& modelMatrix = operation.transform;
Matrix4 modelViewProjectionMatrix = camera.getViewProjection() * modelMatrix;
shader->setParameter(modelParam, modelMatrix);
shader->setParameter(modelViewProjectionParam, modelViewProjectionMatrix);
glBindVertexArray(operation.vao);
glDrawElementsBaseVertex(GL_TRIANGLES, operation.triangleCount * 3, GL_UNSIGNED_INT, (void*)0, operation.indexOffset);
}
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
glDisable(GL_CLIP_DISTANCE0);
}
void ClippingRenderPass::setClippingPlane(const Plane& plane)
{
this->clippingPlane = Vector4(plane.getNormal(), plane.getDistance());
}
SoilRenderPass::SoilRenderPass():
shader(nullptr)
{
horizonTexturesParam = parameterSet.addParameter("horizonTextures", ShaderParameter::Type::INT, 4);
modelParam = parameterSet.addParameter("modelMatrix", ShaderParameter::Type::MATRIX_4, 1);
modelViewProjectionParam = parameterSet.addParameter("modelViewProjectionMatrix", ShaderParameter::Type::MATRIX_4, 1);
horizonOTexture = nullptr;
horizonATexture = nullptr;
horizonBTexture = nullptr;
horizonCTexture = nullptr;
}
bool SoilRenderPass::load(const RenderContext* renderContext)
{
shaderLoader.define("VERTEX_POSITION", EMERGENT_VERTEX_POSITION);
shaderLoader.define("VERTEX_TEXCOORD", EMERGENT_VERTEX_TEXCOORD);
shaderLoader.define("VERTEX_NORMAL", EMERGENT_VERTEX_NORMAL);
shader = shaderLoader.load("data/shaders/soil-profile.glsl", &parameterSet);
if (!shader)
{
return false;
}
return true;
}
void SoilRenderPass::unload()
{
shaderLoader.undefine();
delete shader;
shader = nullptr;
delete horizonOTexture;
delete horizonATexture;
delete horizonBTexture;
delete horizonCTexture;
horizonOTexture = nullptr;
horizonATexture = nullptr;
horizonBTexture = nullptr;
horizonCTexture = nullptr;
}
void SoilRenderPass::render(RenderContext* renderContext)
{
// Bind framebuffer and setup viewport
glBindFramebuffer(GL_FRAMEBUFFER, renderTarget->framebuffer);
glViewport(0, 0, renderTarget->width, renderTarget->height);
// Bind shader
shader->bind();
if (!horizonOTexture || !horizonATexture || !horizonBTexture || !horizonCTexture)
{
return;
}
// Bind textures
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, horizonOTexture->getTextureID());
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, horizonATexture->getTextureID());
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, horizonBTexture->getTextureID());
glActiveTexture(GL_TEXTURE3);
glBindTexture(GL_TEXTURE_2D, horizonCTexture->getTextureID());
// Pass texture units to shader
int textureUnits[] = {0, 1, 2, 3};
shader->setParameter(horizonTexturesParam, 0, &textureUnits[0], 4);
// Enable depth testing
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
// Enable backface culling
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
const Camera& camera = *(renderContext->camera);
const std::list<RenderOperation>* operations = renderContext->queue->getOperations();
// Render operations
for (const RenderOperation& operation: *operations)
{
// Skip render operations with unsupported materials
if (operation.material->getMaterialFormatID() != static_cast<unsigned int>(MaterialFormat::PHYSICAL))
{
continue;
}
const PhysicalMaterial* material = static_cast<const PhysicalMaterial*>(operation.material);
if (!(material->flags & (unsigned int)PhysicalMaterial::Flags::SOIL))
{
continue;
}
const Matrix4& modelMatrix = operation.transform;
Matrix4 modelViewProjectionMatrix = camera.getViewProjection() * modelMatrix;
shader->setParameter(modelParam, modelMatrix);
shader->setParameter(modelViewProjectionParam, modelViewProjectionMatrix);
glBindVertexArray(operation.vao);
glDrawElementsBaseVertex(GL_TRIANGLES, operation.triangleCount * 3, GL_UNSIGNED_INT, (void*)0, operation.indexOffset);
}
}
LightingRenderPass::LightingRenderPass():
shadowMap(0),
shadowCamera(nullptr),
@ -690,7 +546,8 @@ LightingRenderPass::LightingRenderPass():
modelViewProjectionParam = parameterSet.addParameter("modelViewProjectionMatrix", ShaderParameter::Type::MATRIX_4, 1);
normalModelViewParam = parameterSet.addParameter("normalModelViewMatrix", ShaderParameter::Type::MATRIX_3, 1);
normalModelParam = parameterSet.addParameter("normalModelMatrix", ShaderParameter::Type::MATRIX_3, 1);
lightViewProjectionParam = parameterSet.addParameter("lightViewProjectionMatrix", ShaderParameter::Type::MATRIX_4, 1);
lightViewProjectionsParam = parameterSet.addParameter("lightViewProjectionMatrices", ShaderParameter::Type::MATRIX_4, 4);
splitDistancesParam = parameterSet.addParameter("splitDistances", ShaderParameter::Type::VECTOR_4, 1);
shadowMapParam = parameterSet.addParameter("shadowMap", ShaderParameter::Type::INT, 1);
cameraPositionParam = parameterSet.addParameter("cameraPosition", ShaderParameter::Type::VECTOR_3, 1);
directionalLightCountParam = parameterSet.addParameter("directionalLightCount", ShaderParameter::Type::INT, 1);
@ -1181,6 +1038,13 @@ void LightingRenderPass::render(RenderContext* renderContext)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Vector4 splitDistances;
for (int i = 0; i < 4; ++i)
{
splitDistances[i] = shadowMapPass->getSplitDistance(i + 1);
}
Vector3 directionalLightColors[3];
Vector3 directionalLightDirections[3];
@ -1224,7 +1088,13 @@ void LightingRenderPass::render(RenderContext* renderContext)
}
// Calculate the (light-space) view-projection matrix
Matrix4 lightViewProjectionMatrix = shadowMapPass->getTileMatrix(0) * biasMatrix * shadowMapPass->getCropMatrix(0) * shadowCamera->getViewProjection();
Matrix4 lightViewProjectionMatrices[4];
for (int i = 0; i < 4; ++i)
{
lightViewProjectionMatrices[i] = shadowMapPass->getTileMatrix(i) * biasMatrix * shadowMapPass->getCropMatrix(i) * shadowCamera->getViewProjection();
}
//Matrix4 lightViewProjectionMatrix = biasMatrix * shadowCamera->getViewProjection();
glActiveTexture(GL_TEXTURE3);
@ -1280,7 +1150,8 @@ void LightingRenderPass::render(RenderContext* renderContext)
shader->bind();
// Pass static params
shader->setParameter(lightViewProjectionParam, lightViewProjectionMatrix);
shader->setParameter(lightViewProjectionsParam, 0, &lightViewProjectionMatrices[0], 4);
shader->setParameter(splitDistancesParam, splitDistances);
shader->setParameter(albedoOpacityMapParam, 0);
shader->setParameter(metalnessRoughnessMapParam, 1);
shader->setParameter(normalOcclusionMapParam, 2);

+ 5
- 67
src/render-passes.hpp View File

@ -98,7 +98,9 @@ public:
inline void setViewCamera(const Camera* camera) { this->viewCamera = camera; }
inline void setLightCamera(Camera* camera) { this->lightCamera = camera; }
inline float getSplitDistance(std::size_t index) const { return splitDistances[index]; }
inline int getFrustumSplitCount() const { return frustumSplitCount; }
inline const ViewFrustum& getSplitViewFrustum(std::size_t index) const { return splitViewFrustum->getSubfrustum(index); }
inline const Matrix4& getCropMatrix(std::size_t index) const { return cropMatrices[index]; }
inline const Matrix4& getTileMatrix(std::size_t index) const { return tileMatrices[index]; }
@ -115,6 +117,7 @@ private:
int maxBoneCount;
int frustumSplitCount;
float* splitDistances;
int shadowMapResolution;
int croppedShadowMapResolution;
Vector4* croppedShadowMapViewports;
@ -125,72 +128,6 @@ private:
SplitViewFrustum* splitViewFrustum;
};
/**
* Writes clipped edges to stencil buffer.
*/
class ClippingRenderPass: public RenderPass
{
public:
ClippingRenderPass();
virtual bool load(const RenderContext* renderContext);
virtual void unload();
virtual void render(RenderContext* renderContext);
void setClippingPlane(const Plane& plane);
private:
ShaderParameterSet parameterSet;
const ShaderParameter* modelParam;
const ShaderParameter* modelViewProjectionParam;
const ShaderParameter* clippingPlanesParam;
ShaderLoader shaderLoader;
Shader* shader;
Vector4 clippingPlane;
};
/**
* Renders soil profiles.
*
* A soil profile generally of five soil horizons: O, A, B, C, and R.
*
* Horizon O: Organic
* Horizon A: Surface
* Horizon B: Subsoil
* Horizon C: Substratum
* Horizon R: Bedrock
*
* In this render pass, only the O, A, B, and C horizons are used.
*/
class SoilRenderPass: public RenderPass
{
public:
SoilRenderPass();
virtual bool load(const RenderContext* renderContext);
virtual void unload();
virtual void render(RenderContext* renderContext);
inline void setHorizonOTexture(Texture* texture) { horizonOTexture = texture; }
inline void setHorizonATexture(Texture* texture) { horizonATexture = texture; }
inline void setHorizonBTexture(Texture* texture) { horizonBTexture = texture; }
inline void setHorizonCTexture(Texture* texture) { horizonCTexture = texture; }
private:
ShaderParameterSet parameterSet;
const ShaderParameter* modelParam;
const ShaderParameter* modelViewProjectionParam;
const ShaderParameter* horizonTexturesParam;
ShaderLoader shaderLoader;
Shader* shader;
Texture* horizonOTexture;
Texture* horizonATexture;
Texture* horizonBTexture;
Texture* horizonCTexture;
};
/**
* Renders scene geometry.
*/
@ -226,7 +163,8 @@ private:
const ShaderParameter* modelViewProjectionParam;
const ShaderParameter* normalModelViewParam;
const ShaderParameter* normalModelParam;
const ShaderParameter* lightViewProjectionParam;
const ShaderParameter* lightViewProjectionsParam;
const ShaderParameter* splitDistancesParam;
const ShaderParameter* shadowMapParam;
const ShaderParameter* cameraPositionParam;
const ShaderParameter* directionalLightCountParam;

+ 2
- 2
src/states/game-state.cpp View File

@ -60,8 +60,8 @@ void GameState::enter()
}
// Setup HUD
application->rectangularPaletteImage->setVisible(true);
application->rectangularPaletteImage->setActive(true);
//application->rectangularPaletteImage->setVisible(true);
//application->rectangularPaletteImage->setActive(true);
application->toolbar->getContainer()->setVisible(true);
application->toolbar->getContainer()->setActive(true);

Loading…
Cancel
Save