From d218d158f176a3dfd0f58933b08487f109e775fa Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Sun, 9 Jun 2024 01:27:32 +0300 Subject: [PATCH] Working on models --- src/ModelManager/ModelManager.cpp | 6 ++++++ src/Render/SalmonRender/SalmonRenderInterface.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ModelManager/ModelManager.cpp b/src/ModelManager/ModelManager.cpp index fa91202..1e85f68 100644 --- a/src/ModelManager/ModelManager.cpp +++ b/src/ModelManager/ModelManager.cpp @@ -256,6 +256,7 @@ void TLiteModel::MoveModel(const vec3& v) { for (cardinal i = 0; i < TriangleCount * 3; i++) { + vertexDataStruct.PositionData[i] += v; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] += v; } } @@ -265,6 +266,7 @@ void TLiteModel::RotateModel(const mat3& r) for (cardinal i = 0; i < TriangleCount * 3; i++) { + vertexDataStruct.PositionData[i] = r * vertexDataStruct.PositionData[i]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_NORMAL_ATTRIB][i]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i] = r * TriangleList.Data.Vec3CoordArr[CONST_STRING_TANGENT_ATTRIB][i]; @@ -277,6 +279,7 @@ void TLiteModel::ScaleModel(float s) for (cardinal i = 0; i < TriangleCount * 3; i++) { + vertexDataStruct.PositionData[i] *= s; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i] *= s; } @@ -288,6 +291,9 @@ void TLiteModel::ScaleModel(const vec3& s) for (cardinal i = 0; i < TriangleCount * 3; i++) { + vertexDataStruct.PositionData[i].v[0] *= s.v[0]; + vertexDataStruct.PositionData[i].v[1] *= s.v[1]; + vertexDataStruct.PositionData[i].v[2] *= s.v[2]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[0] *= s.v[0]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[1] *= s.v[1]; //TriangleList.Data.Vec3CoordArr[CONST_STRING_POSITION_ATTRIB][i].v[2] *= s.v[2]; diff --git a/src/Render/SalmonRender/SalmonRenderInterface.cpp b/src/Render/SalmonRender/SalmonRenderInterface.cpp index 64bb0f0..035bc39 100644 --- a/src/Render/SalmonRender/SalmonRenderInterface.cpp +++ b/src/Render/SalmonRender/SalmonRenderInterface.cpp @@ -196,7 +196,7 @@ void TSalmonRendererInterface::SetGLCamAngleView() TranslateMatrix(vec3(0.0f, 0.0f, -CamDist)); RotateMatrix(vec4(1.f * sin(CamPhi / 2.f), 0.f, 0.f, 1.f * cos(CamPhi / 2.f))); RotateMatrix(vec4(0.f, 1.f * sin(CamAlpha / 2.f), 0.f, 1.f * cos(CamAlpha / 2.f))); - TranslateMatrix(CamPos); + TranslateMatrix(-CamVec);