mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-21 10:49:23 +00:00
Removed dependencies on GLM
This commit is contained in:
@@ -74,7 +74,6 @@ LIBS += -L$$EXTERNALS_DIR/glew-2.0.0/lib/Release/x64 -lglew32s \
|
||||
INCLUDEPATH += $$PWE_MAIN_INCLUDE \
|
||||
$$EXTERNALS_DIR/assimp/include \
|
||||
$$EXTERNALS_DIR/glew-2.0.0/include \
|
||||
$$EXTERNALS_DIR/glm/glm \
|
||||
$$EXTERNALS_DIR/lzo-2.09/include \
|
||||
$$EXTERNALS_DIR/nodtool/include \
|
||||
$$EXTERNALS_DIR/nodtool/logvisor/include \
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "CGraphics.h"
|
||||
#include <Math/CQuaternion.h>
|
||||
#include <Math/MathUtil.h>
|
||||
#include <gtc/matrix_transform.hpp>
|
||||
|
||||
CCamera::CCamera()
|
||||
: mMode(eFreeCamera)
|
||||
@@ -243,15 +242,17 @@ void CCamera::UpdateTransform() const
|
||||
|
||||
void CCamera::UpdateView() const
|
||||
{
|
||||
// todo: don't use glm
|
||||
UpdateTransform();
|
||||
|
||||
if (mViewDirty)
|
||||
{
|
||||
glm::vec3 glmpos(mPosition.X, mPosition.Y, mPosition.Z);
|
||||
glm::vec3 glmdir(mDirection.X, mDirection.Y, mDirection.Z);
|
||||
glm::vec3 glmup(mUpVector.X, mUpVector.Y, mUpVector.Z);
|
||||
mViewMatrix = CMatrix4f::FromGlmMat4(glm::lookAt(glmpos, glmpos + glmdir, glmup)).Transpose();
|
||||
mViewMatrix = CMatrix4f(
|
||||
mRightVector.X, mRightVector.Y, mRightVector.Z, -mRightVector.Dot(mPosition),
|
||||
mUpVector.X, mUpVector.Y, mUpVector.Z, -mUpVector.Dot(mPosition),
|
||||
-mDirection.X, -mDirection.Y, -mDirection.Z, mDirection.Dot(mPosition),
|
||||
0.f, 0.f, 0.f, 1.f
|
||||
);
|
||||
|
||||
mViewDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <gtx/transform.hpp>
|
||||
|
||||
// ************ STATIC MEMBER INITIALIZATION ************
|
||||
u32 CRenderer::sNumRenderers = 0;
|
||||
|
||||
@@ -101,9 +101,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, u32 PassIndex)
|
||||
case eInverseMV: // Mode 0
|
||||
case eSimpleMode: // Mode 10 - maybe not correct?
|
||||
{
|
||||
glm::mat4 InvMV = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
|
||||
InvMV[0][3] = InvMV[1][3] = InvMV[2][3] = 0.f;
|
||||
TexMtx = CMatrix4f::FromGlmMat4(InvMV);
|
||||
TexMtx = (ModelMtx * ViewMtx).Transpose().Inverse();
|
||||
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, 0.5f,
|
||||
0.0f, 0.5f, 0.0f, 0.5f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
@@ -113,8 +111,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, u32 PassIndex)
|
||||
|
||||
case eInverseMVTranslated: // Mode 1
|
||||
{
|
||||
glm::mat4 InvMV = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
|
||||
TexMtx = CMatrix4f::FromGlmMat4(InvMV);
|
||||
TexMtx = (ModelMtx * ViewMtx).Transpose().Inverse();
|
||||
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, 0.5f,
|
||||
0.0f, 0.5f, 0.0f, 0.5f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
@@ -166,7 +163,7 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, u32 PassIndex)
|
||||
case eModelMatrix: // Mode 6
|
||||
{
|
||||
// It looks ok, but I can't tell whether it's correct...
|
||||
TexMtx = CMatrix4f::FromGlmMat4(glm::transpose(ModelMtx.ToGlmMat4()));
|
||||
TexMtx = ModelMtx.Transpose();
|
||||
PostMtx = CMatrix4f(0.5f, 0.0f, 0.0f, TexMtx[0][3] * 0.50000001f,
|
||||
0.0f, 0.5f, 0.0f, TexMtx[1][3] * 0.50000001f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
@@ -180,9 +177,8 @@ void CMaterialPass::SetAnimCurrent(FRenderOptions Options, u32 PassIndex)
|
||||
{
|
||||
CMatrix4f View = CGraphics::sMVPBlock.ViewMatrix;
|
||||
|
||||
glm::mat4 Mtx = glm::inverse(glm::transpose(ViewMtx.ToGlmMat4()) * glm::transpose(ModelMtx.ToGlmMat4()));
|
||||
Mtx[0][3] = Mtx[1][3] = Mtx[2][3] = 0.f;
|
||||
TexMtx = CMatrix4f::FromGlmMat4(Mtx);
|
||||
TexMtx = (ModelMtx * ViewMtx).Transpose().Inverse();
|
||||
TexMtx[0][3] = TexMtx[1][3] = TexMtx[2][3] = 0.f;
|
||||
|
||||
float XY = (View[3][0] + View[3][1]) * 0.025f * mAnimParams[1];
|
||||
XY = (XY - (int) XY);
|
||||
|
||||
Reference in New Issue
Block a user