mirror of
https://git.coom.tech/drummyfish/small3dlib.git
synced 2024-11-23 20:59:58 +01:00
Fix warnings
This commit is contained in:
parent
3bd2872d5d
commit
9a24ad5ade
2 changed files with 15 additions and 11 deletions
14
small3dlib.h
14
small3dlib.h
|
@ -393,9 +393,9 @@ void S3L_initDrawConfig(S3L_DrawConfig *config);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
S3L_Unit *vertices;
|
const S3L_Unit *vertices;
|
||||||
S3L_Index vertexCount;
|
S3L_Index vertexCount;
|
||||||
S3L_Index *triangles;
|
const S3L_Index *triangles;
|
||||||
S3L_Index triangleCount;
|
S3L_Index triangleCount;
|
||||||
S3L_Transform3D transform;
|
S3L_Transform3D transform;
|
||||||
S3L_DrawConfig config;
|
S3L_DrawConfig config;
|
||||||
|
@ -906,7 +906,7 @@ void S3L_rotationToDirections(
|
||||||
forw->x = 0;
|
forw->x = 0;
|
||||||
forw->y = 0;
|
forw->y = 0;
|
||||||
forw->z = length;
|
forw->z = length;
|
||||||
S3L_vec3Xmat4(forw,*m);
|
S3L_vec3Xmat4(forw,&m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (right != 0)
|
if (right != 0)
|
||||||
|
@ -914,7 +914,7 @@ void S3L_rotationToDirections(
|
||||||
right->x = length;
|
right->x = length;
|
||||||
right->y = 0;
|
right->y = 0;
|
||||||
right->z = 0;
|
right->z = 0;
|
||||||
S3L_vec3Xmat4(right,*m);
|
S3L_vec3Xmat4(right,&m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (up != 0)
|
if (up != 0)
|
||||||
|
@ -922,7 +922,7 @@ void S3L_rotationToDirections(
|
||||||
up->x = 0;
|
up->x = 0;
|
||||||
up->y = length;
|
up->y = length;
|
||||||
up->z = 0;
|
up->z = 0;
|
||||||
S3L_vec3Xmat4(up,*m);
|
S3L_vec3Xmat4(up,&m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1773,8 +1773,8 @@ void S3L_drawScene(S3L_Scene scene)
|
||||||
{
|
{
|
||||||
for (S3L_Index modelIndex; modelIndex < scene.modelCount; ++modelIndex)
|
for (S3L_Index modelIndex; modelIndex < scene.modelCount; ++modelIndex)
|
||||||
{
|
{
|
||||||
S3L_Unit *vertices = scene.models[modelIndex].vertices;
|
const S3L_Unit *vertices = scene.models[modelIndex].vertices;
|
||||||
S3L_Index *triangles = scene.models[modelIndex].triangles;
|
const S3L_Index *triangles = scene.models[modelIndex].triangles;
|
||||||
|
|
||||||
S3L_Index triangleIndex = 0;
|
S3L_Index triangleIndex = 0;
|
||||||
S3L_Index coordIndex = 0;
|
S3L_Index coordIndex = 0;
|
||||||
|
|
12
testSDL.c
12
testSDL.c
|
@ -17,7 +17,7 @@
|
||||||
#define S3L_COMPUTE_DEPTH 1
|
#define S3L_COMPUTE_DEPTH 1
|
||||||
#define S3L_PERSPECTIVE_CORRECTION 1
|
#define S3L_PERSPECTIVE_CORRECTION 1
|
||||||
|
|
||||||
#include "s3l.h"
|
#include "small3dlib.h"
|
||||||
|
|
||||||
#include "house.h"
|
#include "house.h"
|
||||||
|
|
||||||
|
@ -106,7 +106,8 @@ void drawPixel(S3L_PixelInfo *p)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
S3L_Unit u, v, *coords;
|
S3L_Unit u, v;
|
||||||
|
const S3L_Unit *coords;
|
||||||
|
|
||||||
coords = tex_coords + p->triangleID * 6;
|
coords = tex_coords + p->triangleID * 6;
|
||||||
/*
|
/*
|
||||||
|
@ -128,7 +129,7 @@ void drawPixel(S3L_PixelInfo *p)
|
||||||
|
|
||||||
uint8_t sss = (p->depth / 5000.0) * 255 ;
|
uint8_t sss = (p->depth / 5000.0) * 255 ;
|
||||||
|
|
||||||
setPixel(p->x,p->y,sss,sss,128);
|
setPixel(p->x,p->y,sss, (p->triangleID * 37) % 255 ,128);
|
||||||
|
|
||||||
//setPixel(p->x,p->y,p->modelID * 64,p->modelID * 128,255);
|
//setPixel(p->x,p->y,p->modelID * 64,p->modelID * 128,255);
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ int main()
|
||||||
|
|
||||||
scene.camera.transform.translation.z = -S3L_FRACTIONS_PER_UNIT * 2;
|
scene.camera.transform.translation.z = -S3L_FRACTIONS_PER_UNIT * 2;
|
||||||
scene.modelCount = 2;
|
scene.modelCount = 2;
|
||||||
scene.models = ⊧
|
scene.models = models;
|
||||||
|
|
||||||
scene.models[0].vertices = ver;
|
scene.models[0].vertices = ver;
|
||||||
scene.models[0].vertexCount = S3L_CUBE_VERTEX_COUNT;
|
scene.models[0].vertexCount = S3L_CUBE_VERTEX_COUNT;
|
||||||
|
@ -181,9 +182,12 @@ int main()
|
||||||
|
|
||||||
// scene.models[1] = scene.models[0];
|
// scene.models[1] = scene.models[0];
|
||||||
// scene.models[1].transform.translation.x = 0.5 * S3L_FRACTIONS_PER_UNIT;
|
// scene.models[1].transform.translation.x = 0.5 * S3L_FRACTIONS_PER_UNIT;
|
||||||
|
|
||||||
scene.models[1] = house;
|
scene.models[1] = house;
|
||||||
S3L_initTransoform3D(&(scene.models[1].transform));
|
S3L_initTransoform3D(&(scene.models[1].transform));
|
||||||
S3L_initDrawConfig(&(scene.models[1].config));
|
S3L_initDrawConfig(&(scene.models[1].config));
|
||||||
|
scene.models[1].transform.translation.y = -1 * S3L_FRACTIONS_PER_UNIT;
|
||||||
|
scene.models[1].transform.translation.z = 4 * S3L_FRACTIONS_PER_UNIT;
|
||||||
|
|
||||||
// scene.camera.transform.translation.x = S3L_FRACTIONS_PER_UNIT;
|
// scene.camera.transform.translation.x = S3L_FRACTIONS_PER_UNIT;
|
||||||
// scene.camera.transform.translation.y = S3L_FRACTIONS_PER_UNIT;
|
// scene.camera.transform.translation.y = S3L_FRACTIONS_PER_UNIT;
|
||||||
|
|
Loading…
Reference in a new issue