mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-21 20:39:57 +01:00
Remove some warnings
This commit is contained in:
parent
c2829c2177
commit
3e4fbbeca1
4 changed files with 11 additions and 14 deletions
|
@ -114,8 +114,8 @@ void drawPixel(S3L_PixelInfo *p)
|
||||||
{
|
{
|
||||||
if (p->triangleID != previousTriangle)
|
if (p->triangleID != previousTriangle)
|
||||||
{
|
{
|
||||||
S3L_Index *uvIndices;
|
const S3L_Index *uvIndices;
|
||||||
S3L_Unit *uvs;
|
const S3L_Unit *uvs;
|
||||||
|
|
||||||
if (p->modelIndex == 0)
|
if (p->modelIndex == 0)
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ int main()
|
||||||
if (event.type == SDL_QUIT)
|
if (event.type == SDL_QUIT)
|
||||||
running = 0;
|
running = 0;
|
||||||
|
|
||||||
uint8_t *state = SDL_GetKeyboardState(NULL);
|
const uint8_t *state = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
int16_t step = (velocity * frameDiffMs) / 1000;
|
int16_t step = (velocity * frameDiffMs) / 1000;
|
||||||
int16_t stepFriction = (FRICTION * frameDiffMs) / 1000;
|
int16_t stepFriction = (FRICTION * frameDiffMs) / 1000;
|
||||||
|
@ -277,7 +277,6 @@ int main()
|
||||||
S3L_rotationToDirections(models[1].transform.rotation,S3L_FRACTIONS_PER_UNIT,&carDirection,0,0);
|
S3L_rotationToDirections(models[1].transform.rotation,S3L_FRACTIONS_PER_UNIT,&carDirection,0,0);
|
||||||
|
|
||||||
S3L_Vec4 previousCarPos = models[1].transform.translation;
|
S3L_Vec4 previousCarPos = models[1].transform.translation;
|
||||||
S3L_Vec4 previousCamPos = scene.camera.transform.translation;
|
|
||||||
|
|
||||||
int16_t friction = 0;
|
int16_t friction = 0;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "../small3dlib.h"
|
#include "../small3dlib.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "grassTexture.h"
|
#include "grassTexture.h"
|
||||||
|
@ -84,7 +85,7 @@ S3L_Unit treeNormals[TREE_VERTEX_COUNT * 3];
|
||||||
S3L_Model3D models[MODELS_TOTAL];
|
S3L_Model3D models[MODELS_TOTAL];
|
||||||
S3L_Scene scene;
|
S3L_Scene scene;
|
||||||
|
|
||||||
int previousTriangle = -1;
|
uint32_t previousTriangle = 1000;
|
||||||
|
|
||||||
S3L_Vec4 toLightDirection;
|
S3L_Vec4 toLightDirection;
|
||||||
|
|
||||||
|
@ -92,7 +93,7 @@ S3L_Vec4 n0, n1, n2, v0, v1, v2;
|
||||||
|
|
||||||
S3L_Vec4 uv0, uv1, uv2;
|
S3L_Vec4 uv0, uv1, uv2;
|
||||||
|
|
||||||
void sampleTexture(uint8_t *texture, int w, int h, float x, float y, uint8_t color[3])
|
void sampleTexture(const uint8_t *texture, int w, int h, float x, float y, uint8_t color[3])
|
||||||
{
|
{
|
||||||
// we do linear interpolation of the samples
|
// we do linear interpolation of the samples
|
||||||
|
|
||||||
|
@ -220,7 +221,7 @@ void drawPixel(S3L_PixelInfo *p)
|
||||||
specularIntensity = 0.8;
|
specularIntensity = 0.8;
|
||||||
specularPower = 40.0;
|
specularPower = 40.0;
|
||||||
|
|
||||||
float dist, dx, dy;
|
float dist;
|
||||||
|
|
||||||
// create wavy normal map for water
|
// create wavy normal map for water
|
||||||
|
|
||||||
|
@ -453,14 +454,10 @@ int main()
|
||||||
char fileName[] = "test00.ppm";
|
char fileName[] = "test00.ppm";
|
||||||
|
|
||||||
S3L_Transform3D transform0, transform1;
|
S3L_Transform3D transform0, transform1;
|
||||||
S3L_Vec4 target0, target1;
|
|
||||||
|
|
||||||
S3L_initTransoform3D(&transform0);
|
S3L_initTransoform3D(&transform0);
|
||||||
S3L_initTransoform3D(&transform1);
|
S3L_initTransoform3D(&transform1);
|
||||||
|
|
||||||
target0 = scene.models[0].transform.translation;
|
|
||||||
target1 = scene.models[2].transform.translation;
|
|
||||||
|
|
||||||
transform0.translation.x = -2 * S3L_FRACTIONS_PER_UNIT;
|
transform0.translation.x = -2 * S3L_FRACTIONS_PER_UNIT;
|
||||||
transform0.translation.y = 5 * S3L_FRACTIONS_PER_UNIT;
|
transform0.translation.y = 5 * S3L_FRACTIONS_PER_UNIT;
|
||||||
transform0.translation.z = -14 * S3L_FRACTIONS_PER_UNIT;
|
transform0.translation.z = -14 * S3L_FRACTIONS_PER_UNIT;
|
||||||
|
|
|
@ -190,8 +190,6 @@ void draw()
|
||||||
|
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
|
||||||
uint32_t f = frame;
|
|
||||||
|
|
||||||
S3L_drawScene(scene);
|
S3L_drawScene(scene);
|
||||||
|
|
||||||
S3L_Vec4 screenPoint;
|
S3L_Vec4 screenPoint;
|
||||||
|
@ -255,7 +253,7 @@ int main()
|
||||||
|
|
||||||
S3L_rotationToDirections(scene.camera.transform.rotation,20,&camF,&camR,0);
|
S3L_rotationToDirections(scene.camera.transform.rotation,20,&camF,&camR,0);
|
||||||
|
|
||||||
uint8_t *state = SDL_GetKeyboardState(NULL);
|
const uint8_t *state = SDL_GetKeyboardState(NULL);
|
||||||
|
|
||||||
if (state[SDL_SCANCODE_A])
|
if (state[SDL_SCANCODE_A])
|
||||||
scene.camera.transform.rotation.y += 1;
|
scene.camera.transform.rotation.y += 1;
|
||||||
|
|
|
@ -2130,7 +2130,9 @@ void S3L_drawTriangle(
|
||||||
int8_t rowCount = S3L_PC_APPROX_LENGTH;
|
int8_t rowCount = S3L_PC_APPROX_LENGTH;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if S3L_Z_BUFFER
|
||||||
S3L_Index zBufferIndex = p.y * S3L_RESOLUTION_X + lXClipped;
|
S3L_Index zBufferIndex = p.y * S3L_RESOLUTION_X + lXClipped;
|
||||||
|
#endif
|
||||||
|
|
||||||
// draw the row -- inner loop:
|
// draw the row -- inner loop:
|
||||||
|
|
||||||
|
@ -2230,6 +2232,7 @@ void S3L_drawTriangle(
|
||||||
|
|
||||||
#if S3L_Z_BUFFER
|
#if S3L_Z_BUFFER
|
||||||
p.previousZ = S3L_zBuffer[zBufferIndex];
|
p.previousZ = S3L_zBuffer[zBufferIndex];
|
||||||
|
|
||||||
zBufferIndex++;
|
zBufferIndex++;
|
||||||
|
|
||||||
if (!S3L_zTest(p.x,p.y,p.depth))
|
if (!S3L_zTest(p.x,p.y,p.depth))
|
||||||
|
|
Loading…
Reference in a new issue