bool BaseGameLogic::Initialize(void) { m_pActorFactory = VCreateActorFactory(); /** // ZIP ResourceZipFile* ZipResource = WE_NEW ResourceZipFile(L"Assets.zip"); ZipResource->VOpen(); int ResourceCount = ZipResource->VGetNumResources(); //ResourceZipFile ZipResource("Assets.zip"); std::string Name1 = ZipResource->VGetResourceName(0); // Resource Loader ResCache* Cache = WE_NEW ResCache(10, ZipResource); if (Cache->Init()) { Resource TestRes("grid.dds"); shared_ptr<ResHandle> texture = Cache->GetHandle(&TestRes); int Size = texture->Size(); char* TextureBitmap = (char*) texture->Buffer(); } */ mat4x4 T = mat4x4(); T = translate(mat4x4(), vec3(1, 1, 1)); for (int i = 0; i < 1; i++) { VCreateActor("actors\\testactor.xml", NULL, &glm::mat4x4(), NULL); //m_pActorFactory->CreateActor("actors\\testactor.xml", NULL, &glm::mat4x4(), NULL); } VCreateActor("actors\\testactor.xml", NULL, &T, NULL); for (int i = 0; i < 3; i++) { //m_pActorFactory->CreateActor("actors\\testactor2.xml", NULL, &glm::mat4x4(), NULL); } //m_pActorFactory->CreateActor("actors\\testactor3.xml", NULL, &glm::mat4x4(), NULL); return true; }
void Lux::Core::Transform::ApplyTransform() { if (m_TransformDirty) { m_TransformMatrix = mat4x4(1.0f); m_TransformMatrix *= toMat4(m_LocalRotation); m_TransformMatrix = translate(m_TransformMatrix, m_Position); m_TransformMatrix *= toMat4(m_Rotation); m_TransformMatrix = scale(m_TransformMatrix, m_Scale); // Calculate forward vector m_Forward = vec3(0, 0, -1) * m_LocalRotation; // Calculate Right vector m_Right = vec3(1, 0, 0) * m_LocalRotation; // Calculate Up vector m_Up = vec3(0, 1, 0) * m_LocalRotation; m_InverseTranslationMatrix = m_TransformMatrix; m_InverseTranslationMatrix[3][0] *= -1; m_InverseTranslationMatrix[3][1] *= -1; m_InverseTranslationMatrix[3][2] *= -1; m_TransformDirty = false; } }
mat4x4 operator*(const mat4x4 &M1, const mat4x4 &M2) { return mat4x4(M1*M2.Cols[0], M1*M2.Cols[1], M1*M2.Cols[2], M1*M2.Cols[3]); }
mat4x4 SingleScatteringDataP20::scaToLab(Numeric *F, Numeric za_sca, Numeric aa_sca, Numeric za_inc, Numeric aa_inc, Numeric theta) const{ Numeric za_sca_rad = za_sca * DEG2RAD; Numeric aa_sca_rad = za_sca * DEG2RAD; Numeric za_inc_rad = za_sca * DEG2RAD; Numeric aa_inc_rad = za_sca * DEG2RAD; return mat4x4(); }
mat4x4 operator*(float f, const mat4x4 &M) { vec4 Mult(f); return mat4x4(Mult*M.Cols[0], Mult*M.Cols[1], Mult*M.Cols[2], Mult*M.Cols[3]); }
void Lux::Core::Transform::Reset() { m_TransformMatrix = mat4x4(); m_Position = vec3(0.0f); m_Scale = vec3(1.0f); m_Rotation = quat(); m_LocalRotation = quat(); m_TransformDirty = true; }
Mesh::Mesh(){ attributes.clear(); this->modelMatrix = mat4x4(); glGenVertexArrays(1, &vao); glBindVertexArray(vao); glBindVertexArray(0); }
Mesh::Mesh(const vector<vec3>& vertices, const vector<GLuint>& indices){ attributes.clear(); this->modelMatrix = mat4x4(); glGenVertexArrays(1, &vao); glBindVertexArray(vao); Attribute vertexAttrib; addVBO(vertices, vertexAttrib); addIndices(indices); glBindVertexArray(0); }
vec4 operator * (const mat4x4 &Matrix, const vec4 &u) { vec4 v; v.x = Matrix.M[0] * u.x + Matrix.M[4] * u.y + Matrix.M[8] * u.z + Matrix.M[12] * u.w; v.y = Matrix.M[1] * u.x + Matrix.M[5] * u.y + Matrix.M[9] * u.z + Matrix.M[13] * u.w; v.z = Matrix.M[2] * u.x + Matrix.M[6] * u.y + Matrix.M[10] * u.z + Matrix.M[14] * u.w; v.w = Matrix.M[3] * u.x + Matrix.M[7] * u.y + Matrix.M[11] * u.z + Matrix.M[15] * u.w; return v; } // ---------------------------------------------------------------------------------------------------------------------------- mat4x4 BiasMatrix = mat4x4(0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.5f, 0.5f, 1.0f); mat4x4 BiasMatrixInverse = mat4x4(2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, 0.0f, -1.0f, -1.0f, -1.0f, 1.0f); // ---------------------------------------------------------------------------------------------------------------------------- // // 0 4 8 12 | + - + - // 1 5 9 13 | - + - + // 2 6 10 14 | + - + - // 3 7 11 15 | - + - + // // ---------------------------------------------------------------------------------------------------------------------------- float det3x3sub(const float *m, int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8) { float det = 0.0f;
mat4x4 SingleScatteringDataP20::getExtinctionMatrix(Numeric za_inc, Numeric aa_inc, Numeric frequency, Numeric temperature) const{ return mat4x4(); }
RootNode::RootNode() : SceneNode(INVALID_ACTOR_ID, "Root", WeakBaseRenderComponentPtr(), RenderPass_0, &mat4x4()) { m_Children.reserve(RenderPass_Last); // Static Render Pass Group shared_ptr<SceneNode> StaticGroup(new SceneNode(INVALID_ACTOR_ID, "StaticGroup", WeakBaseRenderComponentPtr(), RenderPass_Static, &mat4x4())); m_Children.push_back(StaticGroup); // Actor Pass Group shared_ptr<SceneNode> ActorGroup(new SceneNode(INVALID_ACTOR_ID, "ActorGroup", WeakBaseRenderComponentPtr(), RenderPass_Actor, &mat4x4())); m_Children.push_back(ActorGroup); // Background Objects Render Pass Group shared_ptr<SceneNode> BackgroundGroup(new SceneNode(INVALID_ACTOR_ID, "BackgroundGroup", WeakBaseRenderComponentPtr(), RenderPass_Sky, &mat4x4())); m_Children.push_back(BackgroundGroup); // Hidden Objects Render Pass Group shared_ptr<SceneNode> HiddenGroup(new SceneNode(INVALID_ACTOR_ID, "HiddenGroup", WeakBaseRenderComponentPtr(), RenderPass_NotRendered, &mat4x4())); m_Children.push_back(HiddenGroup); }
vec4 operator * (const mat4x4 &Matrix, const vec4 &u) { vec4 v; v.x = Matrix.M[0] * u.x + Matrix.M[4] * u.y + Matrix.M[8] * u.z + Matrix.M[12] * u.w; v.y = Matrix.M[1] * u.x + Matrix.M[5] * u.y + Matrix.M[9] * u.z + Matrix.M[13] * u.w; v.z = Matrix.M[2] * u.x + Matrix.M[6] * u.y + Matrix.M[10] * u.z + Matrix.M[14] * u.w; v.w = Matrix.M[3] * u.x + Matrix.M[7] * u.y + Matrix.M[11] * u.z + Matrix.M[15] * u.w; return v; } // ---------------------------------------------------------------------------------------------------------------------------- mat4x4 BiasMatrix = mat4x4(0.5f, 0.0, 0.0, 0.0, 0.0, 0.5f, 0.0, 0.0, 0.0, 0.0, 0.5f, 0.0, 0.5f, 0.5f, 0.5f, 1.0); mat4x4 BiasMatrixInverse = mat4x4(2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, 0.0, 0.0, 0.0, 2.0, 0.0, -1.0, -1.0, -1.0, 1.0); // ---------------------------------------------------------------------------------------------------------------------------- // // 0 4 8 12 | + - + - // 1 5 9 13 | - + - + // 2 6 10 14 | + - + - // 3 7 11 15 | - + - + // // ---------------------------------------------------------------------------------------------------------------------------- double det3x3sub(const double *m, int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8) { double det = 0.0;
// ----------------------------------------------------------------- void ModuleCamera3D::CalculateViewMatrix() { ViewMatrix = mat4x4(X.x, Y.x, Z.x, 0.0f, X.y, Y.y, Z.y, 0.0f, X.z, Y.z, Z.z, 0.0f, -dot(X, Position), -dot(Y, Position), -dot(Z, Position), 1.0f); ViewMatrixInverse = inverse(ViewMatrix); }