Fixed brick code which caused memory override for mesh data and fucked up rendering
This commit is contained in:
@@ -24,9 +24,10 @@ int main() {
|
||||
|
||||
acidrain::texture_generator tg(256, 256);
|
||||
tg.brick(0, 50, 20, 4, glm::vec4(1), glm::vec4(0));
|
||||
// tg.checker_board(0, 50, glm::vec4(1), glm::vec4(0));
|
||||
|
||||
shared_ptr<mesh> affectedSphere = mesh_generator::sphere(50, 50);
|
||||
map_transform(affectedSphere, tg, 0, 0, 1.2f);
|
||||
map_transform(affectedSphere, tg, 0, 0, 0.2f);
|
||||
calculate_normals(*affectedSphere.get());
|
||||
|
||||
// affectedSphere = mesh_generator::cog(0.2, 0.5, 50, 4, 0.1, 0.2, 0.2, 0.1);
|
||||
@@ -156,9 +157,9 @@ int main() {
|
||||
|
||||
auto lightMeshNode = std::make_shared<mesh_node>("light mesh");
|
||||
lightMeshNode->mesh_ = demo_data::meshes[0];
|
||||
lightMeshNode->material_ = demo_data::materials[3];
|
||||
lightMeshNode->material_ = demo_data::materials[0];
|
||||
lightMeshNode->position = glm::vec3(1, 2, 1);
|
||||
lightMeshNode->scale = glm::vec3(0.1);
|
||||
lightMeshNode->scale = glm::vec3(0.5);
|
||||
|
||||
auto camNode = std::make_shared<camera_node>();
|
||||
camNode->name = "cam1";
|
||||
@@ -210,7 +211,6 @@ int main() {
|
||||
timer timer1;
|
||||
while (!peripherals.should_close() && timer1.seconds_since_start() < DEMO_LENGTH_IN_SECONDS) {
|
||||
double elapsedSeconds = timer1.seconds_since_start();
|
||||
LOG(INFO) << "frame start";
|
||||
bigSphere->mesh_ = mesh_generator::extrude(mesh_generator::sphere(50, 50), {200, 201, 100, 101, 400, 401}, 0.05,
|
||||
(int) ((sin(elapsedSeconds) + 0.5) * 40));
|
||||
|
||||
@@ -218,8 +218,8 @@ int main() {
|
||||
// meshNode->position = glm::vec3(0, 0.001, 0);
|
||||
// camNode->target = glm::vec3(0, 0.0001, 0);
|
||||
// camNode->position = glm::vec3(0, 5, -10);
|
||||
lightNode2->position = glm::vec3(5 * sin(2 * M_PI * 0.15 * elapsedSeconds), 2,
|
||||
5 * cos(2 * M_PI * 0.15 * elapsedSeconds));
|
||||
lightNode2->position = glm::vec3(5 * sin(2 * M_PI * 0.05 * elapsedSeconds), 2,
|
||||
5 * cos(2 * M_PI * 0.05 * elapsedSeconds));
|
||||
lightNode->position = glm::vec3(5 * cos(2 * M_PI * 0.75 * elapsedSeconds), 2,
|
||||
5 * sin(2 * M_PI * 0.75 * elapsedSeconds));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user