Fix roughness in instanced mesh.

This commit is contained in:
vlj 2014-04-20 01:24:32 +02:00
parent 478e904d1c
commit fde29887f0
4 changed files with 5 additions and 3 deletions

View File

@ -83,7 +83,7 @@ RTT::RTT()
RenderTargetTextures[RTT_TMP2] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
RenderTargetTextures[RTT_TMP3] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
RenderTargetTextures[RTT_TMP4] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGB, GL_FLOAT);
RenderTargetTextures[RTT_NORMAL_AND_DEPTH] = generateRTT(res, GL_RGBA16F, GL_RGBA, GL_FLOAT);
RenderTargetTextures[RTT_COLOR] = generateRTT(res, GL_RGBA16F, GL_BGRA, GL_FLOAT);
RenderTargetTextures[RTT_MLAA_COLORS] = generateRTT(res, GL_SRGB, GL_BGR, GL_UNSIGNED_BYTE);
RenderTargetTextures[RTT_LOG_LUMINANCE] = generateRTT(res, GL_R16F, GL_RED, GL_FLOAT);

View File

@ -547,6 +547,7 @@ namespace MeshShader
GLuint InstancedObjectPass1Shader::Program;
GLuint InstancedObjectPass1Shader::attrib_position;
GLuint InstancedObjectPass1Shader::attrib_normal;
GLuint InstancedObjectPass1Shader::attrib_texcoord;
GLuint InstancedObjectPass1Shader::attrib_orientation;
GLuint InstancedObjectPass1Shader::attrib_origin;
GLuint InstancedObjectPass1Shader::attrib_scale;
@ -564,6 +565,7 @@ namespace MeshShader
attrib_position = glGetAttribLocation(Program, "Position");
attrib_scale = glGetAttribLocation(Program, "Scale");
attrib_normal = glGetAttribLocation(Program, "Normal");
attrib_texcoord = glGetAttribLocation(Program, "Texcoord");
uniform_tex = glGetUniformLocation(Program, "tex");
GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData");
glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0);

View File

@ -82,7 +82,7 @@ class InstancedObjectPass1Shader
{
public:
static GLuint Program;
static GLuint attrib_position, attrib_normal, attrib_origin, attrib_orientation, attrib_scale;
static GLuint attrib_position, attrib_normal, attrib_texcoord, attrib_origin, attrib_orientation, attrib_scale;
static GLuint uniform_tex;
static void init();

View File

@ -76,7 +76,7 @@ void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh, GeometricMateria
{
case FPSM_DEFAULT:
mesh.vao_first_pass = createVAO(mesh.vertex_buffer, mesh.index_buffer,
MeshShader::InstancedObjectPass1Shader::attrib_position, -1, -1, MeshShader::InstancedObjectPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
MeshShader::InstancedObjectPass1Shader::attrib_position, MeshShader::InstancedObjectRefPass1Shader::attrib_texcoord, -1, MeshShader::InstancedObjectPass1Shader::attrib_normal, -1, -1, -1, mesh.Stride);
glGenBuffers(1, &instances_vbo);
glBindBuffer(GL_ARRAY_BUFFER, instances_vbo);
glBufferData(GL_ARRAY_BUFFER, instance_pos.size() * sizeof(float), instance_pos.data(), GL_STATIC_DRAW);