fixed version von main.cpp und gamematrix.cpp

This commit is contained in:
webbaer 2025-11-24 17:12:30 +01:00
parent ad3ae081a9
commit 9ce6f05ba7
2 changed files with 11 additions and 11 deletions

View File

@ -1,8 +1,8 @@
#include <gamematrix.h>
static std::array<std::array<double,4>,4> gameMatrix::matmul(const std::array<std::array<double,4>,4>& A,
const std::array<std::array<double,4>,4>& B);{
std::array<std::array<double,4>,4> gameMatrix::matmul(const std::array<std::array<double,4>,4>& A,
const std::array<std::array<double,4>,4>& B) {
std::array<std::array<double,4>,4> result{};
for (int i = 0; i < 4; ++i) {
@ -19,8 +19,7 @@ static std::array<std::array<double,4>,4> gameMatrix::matmul(const std::array<st
}
static std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, char axis);
{
std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, char axis) {
double angle = angle_deg * M_PI / 180.0; // Grad → Radiant
double c = std::cos(angle);
double s = std::sin(angle);
@ -61,8 +60,7 @@ static std::array<std::array<double,4>,4> gameMatrix::rot3D(double angle_deg, ch
return R;
}
static std::array<std::array<double,4>,4> gameMatrix::translate(const std::array<double, 3>& pos);
{
std::array<std::array<double,4>,4> gameMatrix::translate(const std::array<double, 3>& pos) {
std::array<std::array<double,4>,4> T{{
{1, 0, 0, pos[0]},
{0, 1, 0, pos[1]},

View File

@ -1,4 +1,4 @@
#include "../../prog_3/includes/gamecube.h"
#include "gamecube.h"
#include <algorithm>
#include <ctime>
@ -21,15 +21,17 @@ int main()
camera.fovy = 45.0f;
camera.projection = CAMERA_PERSPECTIVE;
// cubePairs = {};
// Nur 3 Farben für 3 Paare
Color colors[] = { RED, GREEN, BLUE };
Color colors[] = { RED, GREEN, BLUE, YELLOW, PINK };
// 6 Karten-Positionen im 3x2 Raster
std::vector<Vec3> positions = {{-2, 0, -2}, {0, 0, -2}, {2, 0, -2},{-2, 0, 0}, {0, 0, 0}, {2, 0, 0}};
std::vector<Vec3> positions = {{-2, 0, -2}, {0, 0, -2}, {2, 0, -2},{-2, 0, 0}, {0, 0, 0},
{2, 0, 0},{2,0,-4},{0,0,-4},{-2,0,-4},{-4,0,-2}};
// Farben doppelt in einen Pool legen und mischen
std::vector<Color> colorPool;
for (int i = 0; i < 3; i++)
for (int i = 0; i <5; i++)
{
colorPool.push_back(colors[i]);
colorPool.push_back(colors[i]);
@ -44,7 +46,7 @@ int main()
// Karten/Würfel erstellen
std::vector<gamecube> cubes;
for (int i = 0; i < 6; i++)
for (int i = 0; i < 10; i++)
cubes.emplace_back(positions[i], colorPool[i]);
gamecube* first = nullptr;