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
|
@ -116,16 +116,16 @@ void RB_CalcDeformVertexes( deformStage_t *ds )
|
|||
vec3_t offset;
|
||||
float scale;
|
||||
float *xyz = ( float * ) tess.xyz;
|
||||
uint32_t *normal = tess.normal;
|
||||
int16_t *normal = tess.normal[0];
|
||||
float *table;
|
||||
|
||||
if ( ds->deformationWave.frequency == 0 )
|
||||
{
|
||||
scale = EvalWaveForm( &ds->deformationWave );
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal++ )
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 )
|
||||
{
|
||||
R_VaoUnpackNormal(offset, *normal);
|
||||
R_VaoUnpackNormal(offset, normal);
|
||||
|
||||
xyz[0] += offset[0] * scale;
|
||||
xyz[1] += offset[1] * scale;
|
||||
|
@ -136,7 +136,7 @@ void RB_CalcDeformVertexes( deformStage_t *ds )
|
|||
{
|
||||
table = TableForFunc( ds->deformationWave.func );
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal++ )
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 )
|
||||
{
|
||||
float off = ( xyz[0] + xyz[1] + xyz[2] ) * ds->deformationSpread;
|
||||
|
||||
|
@ -145,7 +145,7 @@ void RB_CalcDeformVertexes( deformStage_t *ds )
|
|||
ds->deformationWave.phase + off,
|
||||
ds->deformationWave.frequency );
|
||||
|
||||
R_VaoUnpackNormal(offset, *normal);
|
||||
R_VaoUnpackNormal(offset, normal);
|
||||
|
||||
xyz[0] += offset[0] * scale;
|
||||
xyz[1] += offset[1] * scale;
|
||||
|
@ -165,12 +165,12 @@ void RB_CalcDeformNormals( deformStage_t *ds ) {
|
|||
int i;
|
||||
float scale;
|
||||
float *xyz = ( float * ) tess.xyz;
|
||||
uint32_t *normal = tess.normal;
|
||||
int16_t *normal = tess.normal[0];
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal++ ) {
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, normal += 4 ) {
|
||||
vec3_t fNormal;
|
||||
|
||||
R_VaoUnpackNormal(fNormal, *normal);
|
||||
R_VaoUnpackNormal(fNormal, normal);
|
||||
|
||||
scale = 0.98f;
|
||||
scale = R_NoiseGet4f( xyz[0] * scale, xyz[1] * scale, xyz[2] * scale,
|
||||
|
@ -189,7 +189,7 @@ void RB_CalcDeformNormals( deformStage_t *ds ) {
|
|||
|
||||
VectorNormalizeFast( fNormal );
|
||||
|
||||
R_VaoPackNormal((byte *)normal, fNormal);
|
||||
R_VaoPackNormal(normal, fNormal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,17 +203,17 @@ void RB_CalcBulgeVertexes( deformStage_t *ds ) {
|
|||
int i;
|
||||
const float *st = ( const float * ) tess.texCoords[0];
|
||||
float *xyz = ( float * ) tess.xyz;
|
||||
uint32_t *normal = tess.normal;
|
||||
int16_t *normal = tess.normal[0];
|
||||
float now;
|
||||
|
||||
now = backEnd.refdef.time * ds->bulgeSpeed * 0.001f;
|
||||
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 4, normal++ ) {
|
||||
for ( i = 0; i < tess.numVertexes; i++, xyz += 4, st += 4, normal += 4 ) {
|
||||
int off;
|
||||
float scale;
|
||||
vec3_t fNormal;
|
||||
|
||||
R_VaoUnpackNormal(fNormal, *normal);
|
||||
R_VaoUnpackNormal(fNormal, normal);
|
||||
|
||||
off = (float)( FUNCTABLE_SIZE / (M_PI*2) ) * ( st[0] * ds->bulgeWidth + now );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue