About to have to look at shader code again.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "CapsuleMesh.hpp"
|
||||
#include "util/mathutils.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
|
||||
@@ -5,11 +5,21 @@
|
||||
|
||||
#pragma once
|
||||
#include "display/mesh/Mesh.hpp"
|
||||
#include "util/mathutils.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class CapsuleMesh {
|
||||
protected:
|
||||
/**
|
||||
* Calculates a ring of vertices within a capsule.
|
||||
*
|
||||
* @param segments Count of segments in the ring.
|
||||
* @param height Height of the ring.
|
||||
* @param radius Radius of the ring.
|
||||
* @param dr The delta radius of the ring.
|
||||
* @param y The y position of the ring.
|
||||
* @param dy The delta y position of the ring.
|
||||
* @param positions The positions vector to push the positions to.
|
||||
*/
|
||||
static void calculateRing(
|
||||
const int32_t segments,
|
||||
const float_t height,
|
||||
@@ -21,6 +31,13 @@ namespace Dawn {
|
||||
);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a capsule mesh.
|
||||
*
|
||||
* @param mesh Mesh to instanciate.
|
||||
* @param radius Radius of the capsule.
|
||||
* @param height Height of the capsule.
|
||||
*/
|
||||
static void create(
|
||||
Mesh &mesh,
|
||||
const float_t radius,
|
||||
|
||||
@@ -12,6 +12,15 @@
|
||||
namespace Dawn {
|
||||
class CubeMesh {
|
||||
public:
|
||||
/**
|
||||
* Buffers cube mesh vertices onto a mesh.
|
||||
*
|
||||
* @param mesh Mesh to buffer onto.
|
||||
* @param pos Position of the cube.
|
||||
* @param size Size of the cube.
|
||||
* @param verticeStart Starting vertice index.
|
||||
* @param indiceStart Starting indice index.
|
||||
*/
|
||||
static void buffer(
|
||||
Mesh &mesh,
|
||||
const glm::vec3 pos,
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
// https://opensource.org/licenses/MIT
|
||||
|
||||
#include "SphereMesh.hpp"
|
||||
#include "util/mathutils.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
void SphereMesh::createSphere(
|
||||
Mesh *mesh,
|
||||
float_t radius,
|
||||
int32_t slices,
|
||||
int32_t stacks
|
||||
Mesh &mesh,
|
||||
const float_t radius,
|
||||
const int32_t slices,
|
||||
const int32_t stacks
|
||||
) {
|
||||
std::vector<glm::vec3> positions;
|
||||
|
||||
@@ -53,7 +54,7 @@ void SphereMesh::createSphere(
|
||||
}
|
||||
}
|
||||
|
||||
mesh->createBuffers(positions.size(), indices.size());
|
||||
mesh->bufferPositions(0, positions.data(), positions.size());
|
||||
mesh->bufferIndices(0, indices.data(), indices.size());
|
||||
mesh.createBuffers(positions.size(), indices.size());
|
||||
mesh.bufferPositions(0, positions.data(), positions.size());
|
||||
mesh.bufferIndices(0, indices.data(), indices.size());
|
||||
}
|
||||
@@ -5,16 +5,23 @@
|
||||
|
||||
#pragma once
|
||||
#include "display/mesh/Mesh.hpp"
|
||||
#include "util/mathutils.hpp"
|
||||
|
||||
namespace Dawn {
|
||||
class SphereMesh {
|
||||
public:
|
||||
/**
|
||||
* Creates a sphere mesh.
|
||||
*
|
||||
* @param mesh Mesh to instanciate.
|
||||
* @param radius Radius of the sphere.
|
||||
* @param slices How many horizontal slices to make.
|
||||
* @param stacks How many vertical stacks to make.
|
||||
*/
|
||||
static void createSphere(
|
||||
Mesh *mesh,
|
||||
float_t radius,
|
||||
int32_t slices,
|
||||
int32_t stacks
|
||||
Mesh &mesh,
|
||||
const float_t radius,
|
||||
const int32_t slices,
|
||||
const int32_t stacks
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -7,9 +7,7 @@
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
void TriangleMesh::createTriangleMesh(Mesh *mesh) {
|
||||
assertNotNull(mesh, "TriangleMesh::createTriangleMesh: Mesh cannot be null");
|
||||
|
||||
void TriangleMesh::createTriangleMesh(Mesh &mesh) {
|
||||
glm::vec3 positions[3] = {
|
||||
glm::vec3(-0.5f, -0.5f, 0),
|
||||
glm::vec3(0.5f, -0.5f, 0),
|
||||
@@ -26,8 +24,8 @@ void TriangleMesh::createTriangleMesh(Mesh *mesh) {
|
||||
0, 1, 2
|
||||
};
|
||||
|
||||
mesh->createBuffers(3, 3);
|
||||
mesh->bufferPositions(0, positions, 3);
|
||||
mesh->bufferCoordinates(0, coordinates, 3);
|
||||
mesh->bufferIndices(0, indices, 3);
|
||||
mesh.createBuffers(3, 3);
|
||||
mesh.bufferPositions(0, positions, 3);
|
||||
mesh.bufferCoordinates(0, coordinates, 3);
|
||||
mesh.bufferIndices(0, indices, 3);
|
||||
}
|
||||
@@ -14,6 +14,6 @@ namespace Dawn {
|
||||
*
|
||||
* @param mesh Mesh to initialize as a triangle.
|
||||
*/
|
||||
static void createTriangleMesh(Mesh *mesh);
|
||||
static void createTriangleMesh(Mesh &mesh);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user