123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- #include "Zeichnung3D.h"
- using namespace Framework;
- Zeichnung3D::Zeichnung3D()
- : ReferenceCounter()
- {
- welt = welt.identity();
- pos = Vec3< float >(0, 0, 0);
- angle = Vec3< float >(0, 0, 0);
- rend = 0;
- alpha = 0;
- radius = 0;
- size = 1.f;
- }
- Zeichnung3D::~Zeichnung3D()
- {}
- void Zeichnung3D::setPosition(Vec3< float >& p)
- {
- pos = p;
- rend = 1;
- }
- void Zeichnung3D::setPosition(float x, float y, float z)
- {
- pos.x = x;
- pos.y = y;
- pos.z = z;
- rend = 1;
- }
- void Zeichnung3D::setX(float x)
- {
- pos.x = x;
- rend = 1;
- }
- void Zeichnung3D::setY(float y)
- {
- pos.y = y;
- rend = 1;
- }
- void Zeichnung3D::setZ(float z)
- {
- pos.z = z;
- rend = 1;
- }
- void Zeichnung3D::setDrehung(Vec3< float >& d)
- {
- angle = d;
- rend = 1;
- }
- void Zeichnung3D::setDrehung(float xWinkel, float yWinkel, float zWinkel)
- {
- angle.x = xWinkel;
- angle.y = yWinkel;
- angle.z = zWinkel;
- rend = 1;
- }
- void Zeichnung3D::setDrehungX(float winkel)
- {
- angle.x = winkel;
- rend = 1;
- }
- void Zeichnung3D::setDrehungY(float winkel)
- {
- angle.y = winkel;
- rend = 1;
- }
- void Zeichnung3D::setDrehungZ(float winkel)
- {
- angle.z = winkel;
- rend = 1;
- }
- void Zeichnung3D::setAlpha(bool a)
- {
- alpha = a;
- rend = 1;
- }
- void Zeichnung3D::setSize(float size)
- {
- this->size = size;
- }
- int Zeichnung3D::errechneMatrizen(Mat4< float >& viewProj, Mat4< float >* matBuffer)
- {
- matBuffer[0] = viewProj * welt;
- return 1;
- }
- void Zeichnung3D::doMausEreignis(MausEreignis3D& me)
- {}
- void Zeichnung3D::doTastaturEreignis(TastaturEreignis& te)
- {}
- bool Zeichnung3D::tick(double tickval)
- {
- if (rend)
- {
- welt = welt.translation(pos) * welt.rotationZ(angle.z) * welt.rotationX(angle.x) * welt.rotationY(angle.y) * welt.scaling(size);
- rend = 0;
- return 1;
- }
- return 0;
- }
- bool Zeichnung3D::hatAlpha() const
- {
- return alpha;
- }
- float Zeichnung3D::getRadius() const
- {
- return radius;
- }
- const Vec3< float >& Zeichnung3D::getPos() const
- {
- return pos;
- }
- float Zeichnung3D::getX() const
- {
- return pos.x;
- }
- float Zeichnung3D::getY() const
- {
- return pos.y;
- }
- float Zeichnung3D::getZ() const
- {
- return pos.z;
- }
- const Vec3< float >& Zeichnung3D::getDrehung() const
- {
- return angle;
- }
- float Zeichnung3D::getXDrehung() const
- {
- return angle.x;
- }
- float Zeichnung3D::getYDrehung() const
- {
- return angle.y;
- }
- float Zeichnung3D::getZDrehung() const
- {
- return angle.z;
- }
- const Mat4< float >& Zeichnung3D::getMatrix() const
- {
- return welt;
- }
- Vec3<float> Zeichnung3D::applyWorldTransformation(Vec3<float> modelPos) const
- {
- return welt * modelPos;
- }
|