fixing conflict

This commit is contained in:
albrut committed 2025-03-01 11:16:52 +06:00
commit 0a37ba49c3
7 files changed
+27 -11

No files matched your search

+8 -8
View File
@@ -513,7 +513,7 @@ namespace ZL {
mat.m[8] * mat.m[1] * mat.m[6] - mat.m[8] * mat.m[1] * mat.m[6] -
mat.m[8] * mat.m[2] * mat.m[5]; mat.m[8] * mat.m[2] * mat.m[5];
// Âû÷èñëÿåì äåòåðìèíàíò // ��������� �����������
det = mat.m[0] * inv.m[0] + mat.m[1] * inv.m[4] + mat.m[2] * inv.m[8] + mat.m[3] * inv.m[12]; det = mat.m[0] * inv.m[0] + mat.m[1] * inv.m[4] + mat.m[2] * inv.m[8] + mat.m[3] * inv.m[12];
if (std::fabs(det) < 0.01f) if (std::fabs(det) < 0.01f)
@@ -521,7 +521,7 @@ namespace ZL {
throw std::runtime_error("Error: matrix cannot be inversed!"); throw std::runtime_error("Error: matrix cannot be inversed!");
} }
// Äåëèì âñå ýëåìåíòû íà äåòåðìèíàíò // ����� ��� �������� �� �����������
det = 1.0f / det; det = 1.0f / det;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
@@ -683,10 +683,10 @@ namespace ZL {
Vector4f slerp(const Vector4f& q1, const Vector4f& q2, double t) Vector4f slerp(const Vector4f& q1, const Vector4f& q2, double t)
{ {
// Âû÷èñëÿåì êîñèíóñ óãëà ìåæäó êâàòåðíèîíàìè // ��������� ������� ���� ����� �������������
double cosTheta = q1.dot(q2); double cosTheta = q1.dot(q2);
// Åñëè cosTheta < 0, ìåíÿåì çíàê âòîðîãî êâàòåðíèîíà, ÷òîáû âûáðàòü êðàò÷àéøèé ïóòü // ���� cosTheta < 0, ������ ���� ������� �����������, ����� ������� ���������� ����
Vector4f q2Adjusted = q2; Vector4f q2Adjusted = q2;
if (cosTheta < 0.0) { if (cosTheta < 0.0) {
//q2Adjusted = { -q2.w, -q2.x, -q2.y, -q2.z }; //q2Adjusted = { -q2.w, -q2.x, -q2.y, -q2.z };
@@ -697,7 +697,7 @@ namespace ZL {
cosTheta = -cosTheta; cosTheta = -cosTheta;
} }
// Åñëè êâàòåðíèîíû áëèçêè, èñïîëüçóåì ëèíåéíóþ èíòåðïîëÿöèþ // ���� ����������� ������, ���������� �������� ������������
const double epsilon = 1e-6; const double epsilon = 1e-6;
if (cosTheta > 1.0 - epsilon) { if (cosTheta > 1.0 - epsilon) {
@@ -717,15 +717,15 @@ namespace ZL {
return result.normalized(); return result.normalized();
} }
// Âû÷èñëÿåì óãîë theta // ��������� ���� theta
double theta = std::acos(cosTheta); double theta = std::acos(cosTheta);
double sinTheta = std::sin(theta); double sinTheta = std::sin(theta);
// Âû÷èñëÿåì êîýôôèöèåíòû äëÿ èíòåðïîëÿöèè // ��������� ������������ ��� ������������
double coeff1 = std::sin((1.0 - t) * theta) / sinTheta; double coeff1 = std::sin((1.0 - t) * theta) / sinTheta;
double coeff2 = std::sin(t * theta) / sinTheta; double coeff2 = std::sin(t * theta) / sinTheta;
// Èíòåðïîëèðóåì // �������������
/* /*
Quaternion result = { Quaternion result = {
coeff1 * q1.w + coeff2 * q2Adjusted.w, coeff1 * q1.w + coeff2 * q2Adjusted.w,
+6
View File
@@ -10,6 +10,12 @@
#include "emscripten.h" #include "emscripten.h"
#endif #endif
#ifdef __linux__
#include <GL/gl.h>
#include <GL/glu.h>
#include <GLES3/gl3.h>
#endif
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
+1
View File
@@ -1,4 +1,5 @@
#include "Physics.h" #include "Physics.h"
#include <cmath>
namespace ZL namespace ZL
{ {
+7
View File
@@ -34,3 +34,10 @@ https://github.com/Bly7/OBJ-Loader/blob/master/Source/OBJ_Loader.h
https://github.com/gametutorials/tutorials/blob/master/OpenGL/MD3%20Animation/Main.cpp https://github.com/gametutorials/tutorials/blob/master/OpenGL/MD3%20Animation/Main.cpp
linux:
```
g++ Game.cpp main.cpp Math.cpp OpenGlExtensions.cpp Physics.cpp Renderer.cpp ShaderManager.cpp TextureManager.cpp Utils.cpp -o sdl_app -O2 -std=c++14 $(pkg-config --cflags --libs sdl2 gl)
```
+2 -1
View File
@@ -29,7 +29,8 @@ namespace ZL {
VAOHolder::~VAOHolder() VAOHolder::~VAOHolder()
{ {
#ifndef EMSCRIPTEN #ifndef EMSCRIPTEN
glDeleteVertexArray(1, &vao); glDeleteVertexArrays(1, &vao);
#endif #endif
} }
+1 -1
View File
@@ -1,5 +1,5 @@
#include "Utils.h" #include "Utils.h"
#include <cstring>
#include <iterator> #include <iterator>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
+2 -1
View File
@@ -5,7 +5,8 @@
#include <exception> #include <exception>
#include <map> #include <map>
#include <stack> #include <stack>
#include <memory>
#include <unordered_map>
namespace ZL namespace ZL
{ {
std::string readTextFile(const std::string& filename); std::string readTextFile(const std::string& filename);