From: Peter Schaefer Date: Sun, 26 Apr 2015 18:27:27 +0000 (+0200) Subject: new levelTexture (!Bug with the UV's) X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=c98c6313ccdbdec720ecf885ed7ebc1010e4a9fc;p=cgue_weave.git new levelTexture (!Bug with the UV's) minor fixes --- diff --git a/Weave/Game.cpp b/Weave/Game.cpp index da5dd47..63d32c4 100644 --- a/Weave/Game.cpp +++ b/Weave/Game.cpp @@ -58,7 +58,7 @@ Game::Game() : playing(true) // Shader* shaderSky = new Shader("skybox_VS.hlsl", "skybox_FS.hlsl"); // load LVL - tmp_Scene->addObject(new SceneObject(shader1, scale(3.f * vec3(1.f,.3f,1.f)), "level_test.dae", "sample_2D.png")); + tmp_Scene->addObject(new SceneObject(shader1, scale(3.f * vec3(1.f,.3f,1.f)), "level_test.dae", "model_levelTest_2D.png")); tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f,1.f,0.f)), new BBox() , "")); @@ -102,8 +102,8 @@ Game::Game() : playing(true) //} //ein Gegner //tmp_Scene->addObject(new SceneObject(shader1, glm::mat4(1.0f), "Player.dae", "model_player.png")); - //tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-1.f, 2.f, -2.f)), "../models/box/box.dae", "../Textures/sky_withstars.png")); - tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg")); + //tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(3.f)), "cow/cow.dae", "model_cow_2D.jpg")); + tmp_Scene->addObject(new SceneObject(shader1, translate(vec3(-3.f, .4f, 0.f))*scale(vec3(.4f)), "duck.dae", "model_duck_2D.png")); //import("level_test.dae", tmp_Scene, shader1); diff --git a/Weave/Graphix/Model/IMetaMesh.cpp b/Weave/Graphix/Model/IMetaMesh.cpp index 921189a..e95314e 100644 --- a/Weave/Graphix/Model/IMetaMesh.cpp +++ b/Weave/Graphix/Model/IMetaMesh.cpp @@ -22,7 +22,6 @@ IMetaMesh::IMetaMesh(const string& _modelpath) const aiNode* root = scene->mRootNode; - IMesh* tmpIMesh = nullptr; aiMatrix4x4* aimat; mat4 tmpModelMat; vec3 tmpMin, tmpMax; @@ -32,12 +31,13 @@ IMetaMesh::IMetaMesh(const string& _modelpath) tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4); - tmpIMesh = new IMesh(scene->mMeshes[0], tmpModelMat); + IMesh* tmpIMesh = new IMesh(scene->mMeshes[0], tmpModelMat); models.push_back(tmpIMesh); tmpIMesh->getBBmm(BBmin, BBmax); - for (auto i = 1; i < scene->mNumMeshes; i++) + for (uint i = 1; i < scene->mNumMeshes; i++) { + //delete tmpIMesh; aimat = &(root->mChildren[i]->mTransformation); tmpModelMat = mat4(aimat->a1, aimat->c1, -aimat->b1, aimat->d1, aimat->a2, aimat->c2, -aimat->b2, aimat->d2, aimat->a3, aimat->c3, -aimat->b3, aimat->d3, aimat->a4, aimat->c4, -aimat->b4, aimat->d4); @@ -52,7 +52,8 @@ IMetaMesh::IMetaMesh(const string& _modelpath) if (tmpMax[j] > BBmax[j]) BBmax[j] = tmpMax[j]; } - } + } + //delete tmpIMesh; updateBB(BBmin, BBmax); } else diff --git a/Weave/Graphix/Model/Model.cpp b/Weave/Graphix/Model/Model.cpp index b203be0..ed12071 100644 --- a/Weave/Graphix/Model/Model.cpp +++ b/Weave/Graphix/Model/Model.cpp @@ -83,14 +83,12 @@ void Model::drawModel() const void Model::drawModel(Shader* _shader, Texture* _texture, const mat4& _modelMat) const { - bool wireframe = Events::isKToggleActive(SDLK_F3); //Message::info("Error from before?"); //Graphix::getGlError(); useModel(_shader); //Message::info("IMesh loading Coordinates"); //Graphix::getGlError(); - if (!wireframe) - useTexture(_texture, _shader); + useTexture(_texture, _shader); //Message::info("IMesh loading Texture"); //Graphix::getGlError(); useModelMat(_modelMat, _shader); diff --git a/Weave/Graphix/SceneObject.cpp b/Weave/Graphix/SceneObject.cpp index 6b145d1..1e1948b 100644 --- a/Weave/Graphix/SceneObject.cpp +++ b/Weave/Graphix/SceneObject.cpp @@ -188,7 +188,7 @@ void SceneObject::turnTo(vec3& direction, float speed){ float rot_angle = orientedAngle(normalize((vec3)(modelMat * vec4(0.f, 0.f, 1.f, 1.f))), direction, vec3(0.f, 1.f, 0.f)); if (abs(rot_angle) / M_PI > speed) - perc = speed / abs(rot_angle) * M_PI; + perc = speed / abs(rot_angle) * (float)M_PI; modelMat = rotate(rot_angle *perc, vec3(0.f, 1.f, 0.f)) * modelMat; modelMat = translate(pos) * modelMat; diff --git a/textures/model_levelTest_2D.png b/textures/model_levelTest_2D.png new file mode 100644 index 0000000..2aa9b42 Binary files /dev/null and b/textures/model_levelTest_2D.png differ diff --git a/textures/model_levelTest_2D.psb b/textures/model_levelTest_2D.psb new file mode 100644 index 0000000..832e5df Binary files /dev/null and b/textures/model_levelTest_2D.psb differ