Fixed whatever was wrong with my shader

This commit is contained in:
2022-12-05 19:27:32 -08:00
parent c426dfe4d1
commit 0a4170ea3d
21 changed files with 284 additions and 61 deletions

View File

@ -50,6 +50,33 @@ void QuadMesh::bufferQuadMesh(
);
}
void QuadMesh::bufferCoordinates(
Mesh *mesh,
glm::vec2 uv0, glm::vec2 uv1,
int32_t verticeStart
) {
assertNotNull(mesh);
mesh->bufferCoordinates(verticeStart, std::array<glm::vec2, QUAD_VERTICE_COUNT>{{
uv0, glm::vec2(uv1.x, uv0.y),
glm::vec2(uv0.x, uv1.y), uv1
}});
}
void QuadMesh::bufferPositions(
Mesh *mesh,
glm::vec2 xy0, glm::vec2 xy1,
int32_t verticeStart
) {
mesh->bufferPositions(
verticeStart, std::array<glm::vec3, QUAD_VERTICE_COUNT>{{
glm::vec3(xy0, 0),
glm::vec3(xy1.x, xy0.y, 0),
glm::vec3(xy0.x, xy1.y, 0),
glm::vec3(xy1, 0)
}}
);
}
void QuadMesh::initQuadMesh(
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,

View File

@ -16,7 +16,7 @@ namespace Dawn {
/**
* Buffers the vertices of a quad onto a primitive.
*
* @param primitive The primitive to buffer to.
* @param mesh The primitive to buffer to.
* @param xy0 The lower X and Y coordinate.
* @param uv0 The lower Xand Y texture coordinate.
* @param xy1 The higher X and Y coordinate.
@ -35,7 +35,7 @@ namespace Dawn {
/**
* Buffers the vertices of a quad onto a primitive.
*
* @param primitive The primitive to buffer to.
* @param mesh The primitive to buffer to.
* @param xy0 The lower X and Y coordinate.
* @param uv0 The lower Xand Y texture coordinate.
* @param xy1 The higher X and Y coordinate.
@ -50,6 +50,44 @@ namespace Dawn {
int32_t verticeStart, int32_t indiceStart
);
/**
* Buffers texture coordinates on to an already initialized quad mesh.
*
* @param mesh Mesh to buffer the texture coordinates on to.
* @param uv0 Lower X and Y coordinates.
* @param uv1 Upper X and Y coordinates.
* @param verticeStart Start vertice to buffer in to.
*/
static void bufferCoordinates(
Mesh *mesh,
glm::vec2 uv0, glm::vec2 uv1,
int32_t verticeStart
);
/**
* Buffers the positions of a quad onto a primitive.
*
* @param mesh The primitive to buffer to.
* @param xy0 The lower X and Y coordinate.
* @param xy1 The higher X and Y coordinate.
* @param verticeStart Start vertice to buffer to.
*/
static void bufferPositions(
Mesh *mesh,
glm::vec2 xy0, glm::vec2 xy1,
int32_t verticeStart
);
/**
* Initializes a mesh to be a single quad.
*
* @param mesh The primitive to buffer to.
* @param xy0 The lower X and Y coordinate.
* @param uv0 The lower Xand Y texture coordinate.
* @param xy1 The higher X and Y coordinate.
* @param uv1 The higher X and Y texture coordinate.
* @param z The Z position of the coordinates.
*/
static void initQuadMesh(
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,