Made char rotate

This commit is contained in:
2024-11-25 22:12:03 -06:00
parent 4914ec6168
commit 91caebd385
11 changed files with 174 additions and 52 deletions

View File

@ -84,6 +84,8 @@ void RenderPipeline::renderSceneCamera(
auto rp = renderable->getPasses(ctx);
renderPasses.insert(renderPasses.end(), rp.begin(), rp.end());
}
// TODO: Sort the render passes by priority and z-index
// TODO: Make clearing the buffers editable!
renderTarget->bind();

View File

@ -22,20 +22,13 @@ void QuadMesh::buffer(
glm::vec3(positions.z, positions.w, depth)
};
glm::vec2 coords[QUAD_VERTICE_COUNT] = {
glm::vec2(coordinates.x, coordinates.y),
glm::vec2(coordinates.z, coordinates.y),
glm::vec2(coordinates.x, coordinates.w),
glm::vec2(coordinates.z, coordinates.w)
};
int32_t indices[QUAD_INDICE_COUNT] = {
verticeStart, verticeStart + 1, verticeStart + 3,
verticeStart, verticeStart + 2, verticeStart + 3
};
mesh->bufferPositions(verticeStart, vertices, QUAD_VERTICE_COUNT);
mesh->bufferCoordinates(verticeStart, coords, QUAD_VERTICE_COUNT);
QuadMesh::bufferCoordinates(mesh, coordinates, verticeStart);
mesh->bufferIndices(indiceStart, indices, QUAD_INDICE_COUNT);
}
@ -54,6 +47,21 @@ void QuadMesh::bufferWithIndex(
glm::vec3(positions.z, positions.w, indexOffset + 3)
};
int32_t indices[QUAD_INDICE_COUNT] = {
verticeStart, verticeStart + 1, verticeStart + 3,
verticeStart, verticeStart + 2, verticeStart + 3
};
mesh->bufferPositions(verticeStart, vertices, QUAD_VERTICE_COUNT);
QuadMesh::bufferCoordinates(mesh, coordinates, verticeStart);
mesh->bufferIndices(indiceStart, indices, QUAD_INDICE_COUNT);
}
void QuadMesh::bufferCoordinates(
const std::shared_ptr<Mesh> mesh,
const glm::vec4 coordinates,
const int32_t verticeStart
) {
glm::vec2 coords[QUAD_VERTICE_COUNT] = {
glm::vec2(coordinates.x, coordinates.y),
glm::vec2(coordinates.z, coordinates.y),
@ -61,12 +69,5 @@ void QuadMesh::bufferWithIndex(
glm::vec2(coordinates.z, coordinates.w)
};
int32_t indices[QUAD_INDICE_COUNT] = {
verticeStart, verticeStart + 1, verticeStart + 3,
verticeStart, verticeStart + 2, verticeStart + 3
};
mesh->bufferPositions(verticeStart, vertices, QUAD_VERTICE_COUNT);
mesh->bufferCoordinates(verticeStart, coords, QUAD_VERTICE_COUNT);
mesh->bufferIndices(indiceStart, indices, QUAD_INDICE_COUNT);
}

View File

@ -26,8 +26,8 @@ namespace Dawn {
const std::shared_ptr<Mesh> mesh,
const glm::vec4 positions,
const glm::vec4 coordinates,
const int32_t verticeStart,
const int32_t indiceStart,
const int32_t verticeStart = 0,
const int32_t indiceStart = 0,
const float_t depth = 0.0f
);
@ -47,9 +47,22 @@ namespace Dawn {
const std::shared_ptr<Mesh> mesh,
const glm::vec4 positions,
const glm::vec4 coordinates,
const int32_t verticeStart,
const int32_t indiceStart,
const int32_t verticeStart = 0,
const int32_t indiceStart = 0,
const int32_t indexOffset = 0
);
/**
* Buffers quad texture coordinates to an existing mesh.
*
* @param mesh The mesh to buffer into.
* @param coordinates The coordinates to buffer.
* @param verticeStart The starting index of the vertices.
*/
static void bufferCoordinates(
const std::shared_ptr<Mesh> mesh,
const glm::vec4 coordinates,
const int32_t verticeStart = 0
);
};
}