diff --git a/light.cpp b/light.cpp index 4f794bd..b642f45 100755 --- a/light.cpp +++ b/light.cpp @@ -104,6 +104,7 @@ namespace vb01{ void Light::renderShadow(std::vector descendants, mat4 &proj, mat4 &view){ Root *root = Root::getSingleton(); + Vector3 position = node->getPosition(), direction = node->getGlobalAxis(2); glViewport(0, 0, depthMapSize, depthMapSize); glBindFramebuffer(GL_FRAMEBUFFER, depthmapFBO); @@ -172,6 +173,7 @@ namespace vb01{ } void Light::updateShader(vector materials, int thisId, mat4 &proj, mat4 &view){ + Vector3 position = node->localToGlobalPosition(Vector3::VEC_ZERO), direction = node->getGlobalAxis(2); for(Material *m : materials){ Shader *shader = m->getShader(); shader->use(); diff --git a/light.h b/light.h index d3c44b7..dfd9ae5 100755 --- a/light.h +++ b/light.h @@ -22,9 +22,7 @@ namespace vb01{ ~Light(); void update(); inline void setNode(Node *node){this->node = node;} - inline void setPosition(Vector3 pos){this->position = pos;} inline void setColor(Vector3 color){this->color = color;} - inline void setDirection(Vector3 dir){this->direction = dir;} inline void setAttenuationValues(float a, float b, float c){ attenuationValues.x = a; attenuationValues.y = b; @@ -34,7 +32,6 @@ namespace vb01{ inline void setOuterAngle(float outerAngle){this->outerAngle = outerAngle;} inline void setShadowNearPlane(float nearPlane){this->nearPlane = nearPlane;} inline void setShadowFarPlane(float farPlane){this->farPlane = farPlane;} - inline Vector3 getDirection(){return direction;} inline Vector3 getAttenuationValues(){return attenuationValues;} inline float getInnerAngle(){return innerAngle;} inline float getOuterAngle(){return outerAngle;} @@ -51,7 +48,7 @@ namespace vb01{ Shader *depthMapShader; Texture *depthMap = nullptr; Node *node = nullptr; - Vector3 position = Vector3::VEC_ZERO, color, attenuationValues = Vector3(1.8, .7, 1), direction; + Vector3 color, attenuationValues = Vector3(1.8, .7, 1); float innerAngle = .707, outerAngle = .714, nearPlane = .1, farPlane = 100; unsigned int depthmapFBO, depthMapSize = 1024; };