Refactor struct part 2.
This commit is contained in:
@ -101,12 +101,11 @@ void cubeBuffer(primitive_t *prim,
|
||||
free(indices);
|
||||
}
|
||||
|
||||
primitive_t * cubeCreate(float w, float h, float d) {
|
||||
primitive_t *cube = primitiveCreate(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT);
|
||||
cubeBuffer(cube,
|
||||
void cubeInit(primitive_t *primitive, float w, float h, float d) {
|
||||
primitiveInit(primitive, CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT);
|
||||
cubeBuffer(primitive,
|
||||
-w/2, -h/2, -d/2,
|
||||
w, h, d,
|
||||
0, 0
|
||||
);
|
||||
return cube;
|
||||
}
|
@ -31,9 +31,9 @@ void cubeBuffer(primitive_t *primitive,
|
||||
|
||||
/**
|
||||
* Creates a cube primitive of given size.
|
||||
* @param primitive Primitive to create into a cube.
|
||||
* @param w Width of cube.
|
||||
* @param h Height of cube.
|
||||
* @param d Depth of cube.
|
||||
* @return Primitive of the cube.
|
||||
*/
|
||||
primitive_t * cubeCreate(float w, float h, float d);
|
||||
void cubeInit(primitive_t *primitive, float w, float h, float d);
|
@ -42,19 +42,15 @@ void quadBuffer(primitive_t *primitive, float z,
|
||||
free(indices);
|
||||
}
|
||||
|
||||
primitive_t * quadCreate(float z,
|
||||
void quadInit(primitive_t *primitive, float z,
|
||||
float x0, float y0, float u0, float v0,
|
||||
float x1, float y1, float u1, float v1
|
||||
) {
|
||||
primitive_t *primitive = primitiveCreate(
|
||||
QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT
|
||||
);
|
||||
primitiveInit(primitive, QUAD_VERTICE_COUNT, QUAD_INDICE_COUNT);
|
||||
|
||||
quadBuffer(primitive, z,
|
||||
x0, y0, u0, v0,
|
||||
x1, y1, u1, v1,
|
||||
0, 0
|
||||
);
|
||||
|
||||
return primitive;
|
||||
}
|
@ -35,6 +35,7 @@ void quadBuffer(primitive_t *primitive, float z,
|
||||
/**
|
||||
* Creates a new quad primitive.
|
||||
*
|
||||
* @param primitive Primitive to turn into a quad.
|
||||
* @param z The Z axis coordinate of the quad.
|
||||
* @param x0 The X lower coordinate.
|
||||
* @param y0 The Y lower coordinate.
|
||||
@ -44,9 +45,8 @@ void quadBuffer(primitive_t *primitive, float z,
|
||||
* @param y1 The Y higher coordinate.
|
||||
* @param u1 The X higher texture coordinate.
|
||||
* @param v1 The Y higher texture coordinate.
|
||||
* @return The quad primitive.
|
||||
*/
|
||||
primitive_t * quadCreate(float z,
|
||||
void quadInit(primitive_t *primitive, float z,
|
||||
float x0, float y0, float u0, float v0,
|
||||
float x1, float y1, float u1, float v1
|
||||
);
|
Reference in New Issue
Block a user