mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- Hook up model normals
This commit is contained in:
parent
e0494b6f13
commit
4e14ed4e9e
4 changed files with 6 additions and 10 deletions
|
@ -285,13 +285,10 @@ struct FModelVertex
|
||||||
|
|
||||||
void SetNormal(float nx, float ny, float nz)
|
void SetNormal(float nx, float ny, float nz)
|
||||||
{
|
{
|
||||||
/*
|
int inx = clamp(int(nx * 512), -512, 511);
|
||||||
int inx = int(nx * 512);
|
int iny = clamp(int(ny * 512), -512, 511);
|
||||||
int iny = int(ny * 512);
|
int inz = clamp(int(nz * 512), -512, 511);
|
||||||
int inz = int(nz * 512);
|
packedNormal = /*0x40000000 |*/ ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023);
|
||||||
packedNormal = 0x40000000 | ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023);
|
|
||||||
*/
|
|
||||||
packedNormal = 0; // Per-pixel lighting for models isn't implemented yet so leave this at 0 for now.
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ unsigned int FModelVertexBuffer::SetupFrame(unsigned int frame1, unsigned int fr
|
||||||
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x);
|
glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x);
|
||||||
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u);
|
glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u);
|
||||||
glVertexAttribPointer(VATTR_VERTEX2, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame2].x);
|
glVertexAttribPointer(VATTR_VERTEX2, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame2].x);
|
||||||
glVertexAttribPointer(VATTR_NORMAL, 4, GL_UNSIGNED_INT_2_10_10_10_REV, false, sizeof(FModelVertex), &VMO[frame2].packedNormal);
|
glVertexAttribPointer(VATTR_NORMAL, 4, GL_INT_2_10_10_10_REV, true, sizeof(FModelVertex), &VMO[frame2].packedNormal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -280,7 +280,7 @@ bool FRenderState::ApplyShader()
|
||||||
mModelMatrix.matrixToGL(activeShader->modelmatrix_index);
|
mModelMatrix.matrixToGL(activeShader->modelmatrix_index);
|
||||||
VSMatrix norm;
|
VSMatrix norm;
|
||||||
norm.computeNormalMatrix(mModelMatrix);
|
norm.computeNormalMatrix(mModelMatrix);
|
||||||
mNormalModelMatrix.matrixToGL(activeShader->normalmodelmatrix_index);
|
norm.matrixToGL(activeShader->normalmodelmatrix_index);
|
||||||
activeShader->currentModelMatrixState = true;
|
activeShader->currentModelMatrixState = true;
|
||||||
}
|
}
|
||||||
else if (activeShader->currentModelMatrixState)
|
else if (activeShader->currentModelMatrixState)
|
||||||
|
|
|
@ -132,7 +132,6 @@ public:
|
||||||
VSMatrix mModelMatrix;
|
VSMatrix mModelMatrix;
|
||||||
VSMatrix mTextureMatrix;
|
VSMatrix mTextureMatrix;
|
||||||
VSMatrix mNormalViewMatrix;
|
VSMatrix mNormalViewMatrix;
|
||||||
VSMatrix mNormalModelMatrix;
|
|
||||||
|
|
||||||
FRenderState()
|
FRenderState()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue