From: Peter Schaefer Date: Tue, 28 Jun 2016 03:21:14 +0000 (+0200) Subject: added DeadTextur for BOAR X-Git-Url: https://git.leopard-lacewing.eu/?a=commitdiff_plain;h=506e7ac6dc51b0d36aea2b3e17b3aab79ae35222;p=cgue_weave.git added DeadTextur for BOAR deaktivated DEAD Animations for BOAR (cant undo timeshift) --- diff --git a/Weave/Scene/Boar.cpp b/Weave/Scene/Boar.cpp index 275b250..016d8c0 100644 --- a/Weave/Scene/Boar.cpp +++ b/Weave/Scene/Boar.cpp @@ -2,6 +2,9 @@ #include "../GLM.h" #include "../Message.h" +#include "../Graphix/Textures.h" +#include "../Graphix/Model.h" +#include "../Graphix/Shader.h" Boar::Boar(const mat4& _modelMat) : SceneObject(_modelMat, vec4(7.0f, 0.7f, 1.0f, 3.0f), "boar", "model_boar_2D.png") @@ -9,6 +12,9 @@ Boar::Boar(const mat4& _modelMat) : collide_group = COL_ENEMY; collide_with = COL_LEVEL | COL_MARVIN; yStatic = false; + + texture_dead = Texture::newTImage("model_boar_dead_2D.png", vec4(7.0f, 0.7f, 1.0f, 3.0f)); + texture_dead->bindTexture(); } @@ -42,9 +48,9 @@ void Boar::update(float _deltaT) btTransform tmp; - if(!alive) - tmp.setFromOpenGLMatrix(value_ptr(translate(vec3(0.f, .3f, 0.f))*modelMat)); - else + //if(!alive) + // tmp.setFromOpenGLMatrix(value_ptr(translate(vec3(0.f, .3f, 0.f))*modelMat)); + //else tmp.setFromOpenGLMatrix(value_ptr(modelMat)); bt_collision_object->setWorldTransform(tmp); yFloorDist = 100; @@ -58,6 +64,42 @@ void Boar::update(float _deltaT) } } +//void Boar::draw(drawTarget _target) const +//{ +// switch (_target) +// { +// case DRAW_ModelMotionBlur: +// //upload new->old model +// Shader::getShader(SH_ACTIVE)->setUniformLocation("uCur2OldModel", oldModelMat * glm::inverse(modelMat)); +// case DRAW_Model: +// default: +// if (alive) +// texture->useTexture(); +// else +// texture_dead->useTexture(); +// +// if (timeresistant) +// Shader::getShader(SH_ACTIVE)->setUniformLocation("uAddGlow", true); +// model->drawModel(modelMat, dr_Model, vec4(0.9f, 0.f, 0.f, 1.f), currentAnimation, AnimationTime); +// if (timeresistant) +// Shader::getShader(SH_ACTIVE)->setUniformLocation("uAddGlow", false); +// break; +// case DRAW_Wire: +// if (alive) +// texture->useTexture(); +// else +// texture_dead->useTexture(); +// model->drawModel(modelMat, dr_WireT, vec4(0.9f, 0.f, 0.f, 1.f), currentAnimation, AnimationTime); +// break; +// case DRAW_Coll: +// if (collision != nullptr) +// collision->drawModel(modelMat, dr_WireC, vec4(0.9f, 0.f, 0.f, 1.f), currentAnimation, AnimationTime); +// break; +// } +// /* Draw Object*/ +// +//} + void Boar::collides(SceneObject * _other, btPersistentManifold * _contactManifold, float _deltaT) { if (_other->collide_group != COL_MARVIN && _other->collide_group != COL_ENEMY) diff --git a/Weave/Scene/Boar.h b/Weave/Scene/Boar.h index 5708c81..fc3b807 100644 --- a/Weave/Scene/Boar.h +++ b/Weave/Scene/Boar.h @@ -11,6 +11,7 @@ public: ~Boar(); virtual void update(float) override; + //virtual void draw(drawTarget target = DRAW_Model) const override; virtual void collides(SceneObject* other, btPersistentManifold* contactManifold, float deltaT = 1.f) override; @@ -19,5 +20,7 @@ protected: bool nextFrame = true; bool alive = true; + + Texture* texture_dead; }; diff --git a/textures/model_boar_dead_2D.png b/textures/model_boar_dead_2D.png new file mode 100644 index 0000000..dfb11bb Binary files /dev/null and b/textures/model_boar_dead_2D.png differ