Testing some crap

This commit is contained in:
2022-10-30 00:39:07 -07:00
parent 37eaa706b7
commit 928b4b5447
19 changed files with 264 additions and 20 deletions

View File

@ -162,7 +162,7 @@ void TrueTypeFont::buffer(
info->height = mathMax<float_t>(info->height, quad->y1);
// Buffer the quad.
QuadMesh::bufferQuadMesh(mesh,
QuadMesh::bufferQuadMesh(&mesh,
glm::vec2(quad->x0, quad->y0), glm::vec2(quad->s0, quad->t0),
glm::vec2(quad->x1, quad->y1), glm::vec2(quad->s1, quad->t1),
j * QUAD_VERTICE_COUNT, j * QUAD_INDICE_COUNT

View File

@ -8,12 +8,12 @@
using namespace Dawn;
void QuadMesh::bufferQuadMeshWithZ(
Mesh &mesh,
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,
glm::vec2 xy1, glm::vec2 uv1,
float_t z, int32_t verticeStart, int32_t indiceStart
) {
mesh.bufferPositions(
mesh->bufferPositions(
verticeStart, std::array<glm::vec3, QUAD_VERTICE_COUNT>{{
glm::vec3(xy0, z),
glm::vec3(xy1.x, xy0.y, z),
@ -22,14 +22,14 @@ void QuadMesh::bufferQuadMeshWithZ(
}}
);
mesh.bufferCoordinates(
mesh->bufferCoordinates(
verticeStart, std::array<glm::vec2, QUAD_VERTICE_COUNT>{{
uv0, glm::vec2(uv1.x, uv0.y),
glm::vec2(uv0.x, uv1.y), uv1
}}
);
mesh.bufferIndices(
mesh->bufferIndices(
indiceStart, std::array<meshindice_t, QUAD_INDICE_COUNT>{{
verticeStart, verticeStart + 1, verticeStart + 2,
verticeStart + 1, verticeStart + 2, verticeStart + 3
@ -38,7 +38,7 @@ void QuadMesh::bufferQuadMeshWithZ(
}
void QuadMesh::bufferQuadMesh(
Mesh &mesh,
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,
glm::vec2 xy1, glm::vec2 uv1,
int32_t verticeStart, int32_t indiceStart

View File

@ -26,7 +26,7 @@ namespace Dawn {
* @param indiceStart Start indice to buffer to.
*/
static void bufferQuadMeshWithZ(
Mesh &mesh,
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,
glm::vec2 xy1, glm::vec2 uv1,
float_t z, int32_t verticeStart, int32_t indiceStart
@ -44,7 +44,7 @@ namespace Dawn {
* @param indiceStart Start indice to buffer to.
*/
static void bufferQuadMesh(
Mesh &mesh,
Mesh *mesh,
glm::vec2 xy0, glm::vec2 uv0,
glm::vec2 xy1, glm::vec2 uv1,
int32_t verticeStart, int32_t indiceStart

View File

@ -14,7 +14,8 @@ namespace Dawn {
SHADER_PARAMETER_TYPE_BOOLEAN,
SHADER_PARAMETER_TYPE_COLOR,
SHADER_PARAMETER_TYPE_VECTOR3,
SHADER_PARAMETER_TYPE_TEXTURE
SHADER_PARAMETER_TYPE_TEXTURE,
SHADER_PARAMETER_TYPE_FLOAT
};
template<typename T>
@ -102,5 +103,13 @@ namespace Dawn {
* @param texture Texture to bind to the parameter.
*/
virtual void setTexture(T parameter, Texture *texture) = 0;
/**
* Sets a floating point value to the shader.
*
* @param parameter Paramater to set the float ont o.
* @param float Float to bind.
*/
virtual void setFloat(T parameter, float_t value) = 0;
};
}

View File

@ -51,6 +51,10 @@ void Material::setShaderParameters() {
this->shader->setTexture(it->first, this->textureValues[it->first]);
break;
case SHADER_PARAMETER_TYPE_FLOAT:
this->shader->setFloat(it->first, this->floatValues[it->first]);
break;
default:
throw "An unsupported or invalid shader parameter type was supplied.";
}

View File

@ -27,6 +27,7 @@ namespace Dawn {
std::map<shaderparameter_t, glm::mat4> matrixValues;
std::map<shaderparameter_t, glm::vec3> vec3Values;
std::map<shaderparameter_t, Texture*> textureValues;
std::map<shaderparameter_t, float_t> floatValues;
/**
* Material component constructor.

View File

@ -30,7 +30,7 @@ void UIBorder::updatePositions() {
glm::vec2 innerDimensions = overallDimensions - (this->edgeDimensions * 2.0f);
// Top Left.
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
glm::vec2(0, 0),
this->uv0,
edgeDimensions,
@ -39,7 +39,7 @@ void UIBorder::updatePositions() {
);
// Top Center
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
glm::vec2(edgeDimensions.x, 0),
this->uv0 + glm::vec2(oneThird.x, 0),
glm::vec2(edgeDimensions.x + innerDimensions.x, edgeDimensions.y),
@ -48,7 +48,7 @@ void UIBorder::updatePositions() {
);
// Top Right
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
glm::vec2(edgeDimensions.x + innerDimensions.x, 0),
this->uv0 + glm::vec2(oneThird.x * 2.0f, 0),
glm::vec2(overallDimensions.x, edgeDimensions.y),
@ -57,7 +57,7 @@ void UIBorder::updatePositions() {
);
// Middle Left
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
glm::vec2(0, edgeDimensions.y),
this->uv0 + glm::vec2(0, oneThird.y),
glm::vec2(edgeDimensions.x, edgeDimensions.y + innerDimensions.y),
@ -66,7 +66,7 @@ void UIBorder::updatePositions() {
);
// Center
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
edgeDimensions,
this->uv0 + oneThird,
edgeDimensions + innerDimensions,
@ -75,7 +75,7 @@ void UIBorder::updatePositions() {
);
// Middle Right
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
edgeDimensions + glm::vec2(innerDimensions.x, 0),
this->uv0 + glm::vec2(oneThird.x * 2.0f, oneThird.y),
edgeDimensions + innerDimensions + glm::vec2(edgeDimensions.x, 0),
@ -84,7 +84,7 @@ void UIBorder::updatePositions() {
);
// Bottom Left
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
glm::vec2(0.0f, edgeDimensions.y + innerDimensions.y),
this->uv0 + glm::vec2(0.0f, uv1.y - oneThird.y),
glm::vec2(edgeDimensions.x, overallDimensions.y),
@ -93,7 +93,7 @@ void UIBorder::updatePositions() {
);
// Bottom Center
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
edgeDimensions + glm::vec2(0.0f, innerDimensions.y),
this->uv1 - oneThird,
overallDimensions - glm::vec2(edgeDimensions.x, 0.0f),
@ -102,7 +102,7 @@ void UIBorder::updatePositions() {
);
// Bottom Right
QuadMesh::bufferQuadMesh(this->mesh,
QuadMesh::bufferQuadMesh(&this->mesh,
overallDimensions - edgeDimensions,
this->uv1 - oneThird,
overallDimensions,

View File

@ -15,7 +15,7 @@ void UISprite::updatePositions() {
UIComponent::updatePositions();
QuadMesh::bufferQuadMesh(
this->mesh,
&this->mesh,
glm::vec2(0, 0), glm::vec2(0, 0),
glm::vec2(this->width, this->height), glm::vec2(1, 1),
0, 0