OpenGL2: Store normals/tangents as int16_t[4].
This commit is contained in:
parent
762f50757d
commit
dfbaf50324
13 changed files with 288 additions and 1042 deletions
|
@ -350,17 +350,21 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio
|
|||
// The offset is added in the vertex normal vector direction
|
||||
// so all triangles will still fit together.
|
||||
// The 2 unit offset should avoid pretty much all LOD problems.
|
||||
vec3_t fNormal;
|
||||
|
||||
numClipPoints = 3;
|
||||
|
||||
dv = cv->verts + m * cv->width + n;
|
||||
|
||||
VectorCopy(dv[0].xyz, clipPoints[0][0]);
|
||||
VectorMA(clipPoints[0][0], MARKER_OFFSET, dv[0].normal, clipPoints[0][0]);
|
||||
R_VaoUnpackNormal(fNormal, dv[0].normal);
|
||||
VectorMA(clipPoints[0][0], MARKER_OFFSET, fNormal, clipPoints[0][0]);
|
||||
VectorCopy(dv[cv->width].xyz, clipPoints[0][1]);
|
||||
VectorMA(clipPoints[0][1], MARKER_OFFSET, dv[cv->width].normal, clipPoints[0][1]);
|
||||
R_VaoUnpackNormal(fNormal, dv[cv->width].normal);
|
||||
VectorMA(clipPoints[0][1], MARKER_OFFSET, fNormal, clipPoints[0][1]);
|
||||
VectorCopy(dv[1].xyz, clipPoints[0][2]);
|
||||
VectorMA(clipPoints[0][2], MARKER_OFFSET, dv[1].normal, clipPoints[0][2]);
|
||||
R_VaoUnpackNormal(fNormal, dv[1].normal);
|
||||
VectorMA(clipPoints[0][2], MARKER_OFFSET, fNormal, clipPoints[0][2]);
|
||||
// check the normal of this triangle
|
||||
VectorSubtract(clipPoints[0][0], clipPoints[0][1], v1);
|
||||
VectorSubtract(clipPoints[0][2], clipPoints[0][1], v2);
|
||||
|
@ -380,11 +384,14 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio
|
|||
}
|
||||
|
||||
VectorCopy(dv[1].xyz, clipPoints[0][0]);
|
||||
VectorMA(clipPoints[0][0], MARKER_OFFSET, dv[1].normal, clipPoints[0][0]);
|
||||
R_VaoUnpackNormal(fNormal, dv[1].normal);
|
||||
VectorMA(clipPoints[0][0], MARKER_OFFSET, fNormal, clipPoints[0][0]);
|
||||
VectorCopy(dv[cv->width].xyz, clipPoints[0][1]);
|
||||
VectorMA(clipPoints[0][1], MARKER_OFFSET, dv[cv->width].normal, clipPoints[0][1]);
|
||||
R_VaoUnpackNormal(fNormal, dv[cv->width].normal);
|
||||
VectorMA(clipPoints[0][1], MARKER_OFFSET, fNormal, clipPoints[0][1]);
|
||||
VectorCopy(dv[cv->width+1].xyz, clipPoints[0][2]);
|
||||
VectorMA(clipPoints[0][2], MARKER_OFFSET, dv[cv->width+1].normal, clipPoints[0][2]);
|
||||
R_VaoUnpackNormal(fNormal, dv[cv->width + 1].normal);
|
||||
VectorMA(clipPoints[0][2], MARKER_OFFSET, fNormal, clipPoints[0][2]);
|
||||
// check the normal of this triangle
|
||||
VectorSubtract(clipPoints[0][0], clipPoints[0][1], v1);
|
||||
VectorSubtract(clipPoints[0][2], clipPoints[0][1], v2);
|
||||
|
@ -441,8 +448,10 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio
|
|||
{
|
||||
for(j = 0; j < 3; j++)
|
||||
{
|
||||
vec3_t fNormal;
|
||||
v = surf->verts[tri[j]].xyz;
|
||||
VectorMA(v, MARKER_OFFSET, surf->verts[tri[j]].normal, clipPoints[0][j]);
|
||||
R_VaoUnpackNormal(fNormal, surf->verts[tri[j]].normal);
|
||||
VectorMA(v, MARKER_OFFSET, fNormal, clipPoints[0][j]);
|
||||
}
|
||||
|
||||
// add the fragments of this face
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue