MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetSpecialRotatedPoint

Function GetSpecialRotatedPoint

Descent3/TerrainSearch.cpp:349–367  ·  view source on GitHub ↗

Gets a pre-rotated point that does not fall exactly on one of our 255 height values

Source from the content-addressed store, hash-verified

347
348// Gets a pre-rotated point that does not fall exactly on one of our 255 height values
349void GetSpecialRotatedPoint(g3Point *dest, int x, int z, float yvalue) {
350 if (yvalue < 0)
351 yvalue = 0;
352 if (yvalue > MAX_TERRAIN_HEIGHT)
353 yvalue = MAX_TERRAIN_HEIGHT;
354
355 vector up_vector = {0, yvalue, 0};
356 vector dyp = up_vector * *TS_View_matrix;
357
358 dest->p3_vec = TS_PreRows[z];
359 dest->p3_vec += TS_RVectorAdd * x;
360 dest->p3_vec += dyp;
361
362 // also store the unrotated point
363 dest->p3_flags |= PF_ORIGPOINT;
364 dest->p3_vecPreRot.x = TERRAIN_SIZE * x;
365 dest->p3_vecPreRot.y = yvalue;
366 dest->p3_vecPreRot.z = TERRAIN_SIZE * z;
367}
368
369void Terrain_start_frame(vector *eye, matrix *view_orient) {
370 TS_View_position = eye;

Callers 2

RotateTerrainListFunction · 0.85
SimplifyVertexSlowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected