// 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() , ""));
//}
//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);
const aiNode* root = scene->mRootNode;
- IMesh* tmpIMesh = nullptr;
aiMatrix4x4* aimat;
mat4 tmpModelMat;
vec3 tmpMin, tmpMax;
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);
if (tmpMax[j] > BBmax[j])
BBmax[j] = tmpMax[j];
}
- }
+ }
+ //delete tmpIMesh;
updateBB(BBmin, BBmax);
}
else
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);
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;