Add logs and checks
This commit is contained in:
parent
28a1256a88
commit
e9f919052c
5 changed files with 104 additions and 10 deletions
40
renderer.h
40
renderer.h
|
@ -91,6 +91,8 @@ struct
|
|||
void LCR_rendererSetCarTransform(LCR_GameUnit position[3],
|
||||
LCR_GameUnit rotation[3])
|
||||
{
|
||||
LCR_LOG2("setting car transform");
|
||||
|
||||
LCR_renderer.carModel->transform.translation.x =
|
||||
(position[0] * LCR_RENDERER_UNIT) / LCR_GAME_UNIT;
|
||||
LCR_renderer.carModel->transform.translation.y =
|
||||
|
@ -271,7 +273,7 @@ S3L_Index _LCR_rendererAddMapVert(S3L_Unit x, S3L_Unit y, S3L_Unit z)
|
|||
return LCR_renderer.mapModel.vertexCount - 1;
|
||||
}
|
||||
|
||||
LCR_log("couldn't add map vertex!");
|
||||
LCR_LOG0("couldn't add map vertex!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -479,7 +481,7 @@ uint8_t _LCR_rendererCheckMapTriCover(const S3L_Index *t1,
|
|||
*/
|
||||
void _LCR_cullHiddenMapTris(void)
|
||||
{
|
||||
LCR_log("culling invisible triangles");
|
||||
LCR_LOG1("culling invisible triangles");
|
||||
|
||||
int n = 0; // number of removed elements
|
||||
int i = 0;
|
||||
|
@ -567,7 +569,7 @@ void _LCR_cullHiddenMapTris(void)
|
|||
|
||||
void _LCR_makeMapChunks(void)
|
||||
{
|
||||
LCR_log("making map chunks");
|
||||
LCR_LOG1("making map chunks");
|
||||
|
||||
S3L_Index start = 0;
|
||||
|
||||
|
@ -612,7 +614,7 @@ void _LCR_makeMapChunks(void)
|
|||
*/
|
||||
uint8_t _LCR_buildMapModel(void)
|
||||
{
|
||||
LCR_log("building map model");
|
||||
LCR_LOG1("building map model");
|
||||
|
||||
uint8_t blockShapeBytes[LCR_MAP_BLOCK_SHAPE_MAX_BYTES];
|
||||
uint8_t blockShapeByteCount;
|
||||
|
@ -739,14 +741,14 @@ uint8_t _LCR_buildMapModel(void)
|
|||
|
||||
_LCR_cullHiddenMapTris();
|
||||
|
||||
LCR_log("map model built");
|
||||
LCR_LOG1("map model built");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void _LCR_rendererComputeLOD(void)
|
||||
{
|
||||
LCR_log("computing LOD");
|
||||
LCR_LOG1("computing LOD");
|
||||
|
||||
for (int i = 0; i < LCR_RENDERER_LOD_BLOCKS; ++i)
|
||||
LCR_renderer.gridOfLODs[i] = 0;
|
||||
|
@ -767,7 +769,7 @@ void _LCR_rendererComputeLOD(void)
|
|||
|
||||
uint8_t LCR_rendererInit(void)
|
||||
{
|
||||
LCR_log("initializing renderer");
|
||||
LCR_LOG0("initializing renderer");
|
||||
|
||||
LCR_renderer.frame = 0;
|
||||
|
||||
|
@ -834,6 +836,8 @@ LCR_renderer.ghostModel->transform.translation.x -= LCR_GAME_UNIT / 4;
|
|||
LCR_renderer.wheelSteer = 0;
|
||||
#endif
|
||||
|
||||
LCR_LOG2("initializing 3D scene");
|
||||
|
||||
S3L_sceneInit(
|
||||
LCR_renderer.models,LCR_RENDERER_MODEL_COUNT,&LCR_renderer.scene);
|
||||
|
||||
|
@ -864,6 +868,8 @@ void LCR_rendererGetCameraTransform(LCR_GameUnit position[3],
|
|||
void LCR_rendererMoveCamera(LCR_GameUnit forwRightUpOffset[3],
|
||||
LCR_GameUnit yawPitchOffset[2])
|
||||
{
|
||||
LCR_LOG2("moving camera");
|
||||
|
||||
S3L_Vec4 f, r, u;
|
||||
|
||||
S3L_rotationToDirections(LCR_renderer.scene.camera.transform.rotation,
|
||||
|
@ -963,6 +969,8 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h,
|
|||
void _LCR_rendererDrawLODBlock(int blockX, int blockY, int blockZ, unsigned int size,
|
||||
uint16_t color, uint8_t variability)
|
||||
{
|
||||
LCR_LOG2("drawing LOD block");
|
||||
|
||||
S3L_Vec4 p, r;
|
||||
|
||||
p.x = (blockX - LCR_MAP_SIZE_BLOCKS / 2) * LCR_RENDERER_UNIT
|
||||
|
@ -1007,6 +1015,8 @@ void _LCR_rendererDrawLODBlock(int blockX, int blockY, int blockZ, unsigned int
|
|||
*/
|
||||
void LCR_rendererDrawSky(int sky, S3L_Unit offsetH, S3L_Unit offsetV)
|
||||
{
|
||||
LCR_LOG2("drawing sky");
|
||||
|
||||
int anchorPoint[2], y;
|
||||
unsigned long pixelIndex;
|
||||
unsigned int topColor, bottomColor;
|
||||
|
@ -1196,6 +1206,8 @@ S3L_Unit _LCR_rendererSmoothRot(S3L_Unit angleOld, S3L_Unit angleNew,
|
|||
*/
|
||||
void _LCR_rendererLoadMapChunks(void)
|
||||
{
|
||||
LCR_LOG2("loading map chunks");
|
||||
|
||||
int8_t camChunk[3], chunkOffsets[3];
|
||||
S3L_Vec4 cp = LCR_renderer.scene.camera.transform.translation;
|
||||
S3L_Vec4 cf;
|
||||
|
@ -1236,6 +1248,8 @@ void _LCR_rendererLoadMapChunks(void)
|
|||
*/
|
||||
void LCR_rendererDrawLOD(void)
|
||||
{
|
||||
LCR_LOG2("drawing LOD");
|
||||
|
||||
#if LCR_SETTING_LOD_DISTANCE < 64
|
||||
int variability = 0;
|
||||
|
||||
|
@ -1267,6 +1281,8 @@ void LCR_rendererDrawLOD(void)
|
|||
|
||||
void LCR_drawLevelFloor(void)
|
||||
{
|
||||
LCR_LOG2("drawing floor");
|
||||
|
||||
#if LCR_SETTING_FLOOR_PARTICLE_SIZE != 0
|
||||
#define _STEP ((LCR_MAP_SIZE_BLOCKS * LCR_RENDERER_UNIT) / LCR_SETTING_FLOOR_PARTICLE_RESOLUTION)
|
||||
|
||||
|
@ -1302,6 +1318,8 @@ void LCR_drawLevelFloor(void)
|
|||
#if LCR_ANIMATE_CAR
|
||||
void _LCR_rendererAnimateCar(void)
|
||||
{
|
||||
LCR_LOG2("animating car");
|
||||
|
||||
for (int i = LCR_renderer.frame % LCR_SETTING_CAR_ANIMATION_SUBDIVIDE;
|
||||
i < LCR_CAR_VERTEX_COUNT; i += LCR_SETTING_CAR_ANIMATION_SUBDIVIDE)
|
||||
{
|
||||
|
@ -1351,6 +1369,8 @@ void _LCR_rendererAnimateCar(void)
|
|||
|
||||
void LCR_rendererCameraFollow(void)
|
||||
{
|
||||
LCR_LOG2("following camera");
|
||||
|
||||
S3L_Transform3D transPrev = LCR_renderer.scene.camera.transform;
|
||||
|
||||
LCR_renderer.scene.camera.transform.translation.y =
|
||||
|
@ -1427,6 +1447,8 @@ void LCR_rendererSetWheelState(LCR_GameUnit rotation, LCR_GameUnit steer)
|
|||
|
||||
void LCR_rendererDraw(void)
|
||||
{
|
||||
LCR_LOG2("rendering frame (start)");
|
||||
|
||||
// first make sure rotations are in correct range:
|
||||
LCR_renderer.scene.camera.transform.rotation.y = S3L_wrap(
|
||||
LCR_renderer.scene.camera.transform.rotation.y, S3L_F);
|
||||
|
@ -1450,9 +1472,13 @@ void LCR_rendererDraw(void)
|
|||
LCR_drawLevelFloor();
|
||||
LCR_rendererDrawLOD();
|
||||
|
||||
LCR_LOG2("gonna render 3D scene");
|
||||
S3L_drawScene(LCR_renderer.scene);
|
||||
LCR_LOG2("rendering 3D scene done");
|
||||
|
||||
LCR_renderer.frame++;
|
||||
|
||||
LCR_LOG2("rendering frame (end)");
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue