#pragma once #include "Mat4.h" #include "ReferenceCounter.h" namespace Framework { struct MausEreignis3D; struct TastaturEreignis; class Render3D; //! Render3D.h //! An object that can be drawn by the Bildschirm3D class. class Zeichnung3D : public virtual ReferenceCounter { protected: Vec3 pos; //! Position of the object Vec3 angle; //! Rotation angles for x, y and z Mat4 welt; //! World translation matrix float radius; //! The radius of a sphere that encloses the entire object bool alpha; //! Stores whether the object contains partially or fully //! transparent areas bool rend; float size; public: //! Constructor DLLEXPORT Zeichnung3D(); DLLEXPORT virtual ~Zeichnung3D(); //! Sets the position of the drawing in the world //! \param p The position DLLEXPORT void setPosition(const Vec3& p); //! Sets the position of the drawing in the world //! \param x The x position //! \param y The y position //! \param z The z position DLLEXPORT void setPosition(float x, float y, float z); //! Sets the position of the drawing in the world //! \param x The x position DLLEXPORT void setX(float x); //! Sets the position of the drawing in the world //! \param y The y position DLLEXPORT void setY(float y); //! Sets the position of the drawing in the world //! \param z The z position DLLEXPORT void setZ(float z); //! Sets the rotation of the drawing in the world //! \param d The rotation around the x, y and z axes DLLEXPORT void setDrehung(const Vec3& d); //! Sets the rotation of the drawing in the world //! \param xWinkel The rotation around the x axis //! \param yWinkel The rotation around the y axis //! \param zWinkel The rotation around the z axis DLLEXPORT void setDrehung(float xWinkel, float yWinkel, float zWinkel); //! Sets the rotation of the drawing in the world //! \param winkel The rotation around the x axis DLLEXPORT void setDrehungX(float winkel); //! Sets the rotation of the drawing in the world //! \param winkel The rotation around the y axis DLLEXPORT void setDrehungY(float winkel); //! Sets the rotation of the drawing in the world //! \param winkel The rotation around the z axis DLLEXPORT void setDrehungZ(float winkel); //! Sets whether the object contains partially or fully transparent //! areas \param a true if partially or fully transparent areas exist DLLEXPORT void setAlpha(bool a); //! Sets the scaling DLLEXPORT void setSize(float size); //! Calculates the matrices of all bones in the drawing's skeleton //! \param viewProj The multiplied camera matrices //! \param matBuffer An array of matrices to fill //! \return The number of matrices the drawing requires DLLEXPORT virtual int errechneMatrizen( const Mat4& viewProj, Mat4* matBuffer); //! Processes a mouse event //! \param me The mouse event to process DLLEXPORT virtual void doMausEreignis(MausEreignis3D& me); //! Processes a keyboard event //! \param te The keyboard event to process DLLEXPORT virtual void doTastaturEreignis(TastaturEreignis& te); //! Processes elapsed time //! \param tickval The time in seconds since the last call of this //! function \return true if the object changed, false otherwise. DLLEXPORT virtual bool tick(double tickval); //! Returns whether the object contains partially or fully transparent areas DLLEXPORT bool hatAlpha() const; //! Returns the radius of a sphere that encloses the entire model DLLEXPORT inline float getRadius() const; //! Returns a point representing the position of the drawing in the world DLLEXPORT const Vec3& getPos() const; //! Returns the X position of the drawing in the world DLLEXPORT float getX() const; //! Returns the Y position of the drawing in the world DLLEXPORT float getY() const; //! Returns the Z position of the drawing in the world DLLEXPORT float getZ() const; //! Returns a vector representing the rotation of the drawing in the world. //! x is the rotation around the X axis in radians, etc. DLLEXPORT const Vec3& getDrehung() const; //! Returns the rotation around the X axis in radians DLLEXPORT float getXDrehung() const; //! Returns the rotation around the Y axis in radians DLLEXPORT float getYDrehung() const; //! Returns the rotation around the Z axis in radians DLLEXPORT float getZDrehung() const; //! Returns the matrix that translates the drawing into world space DLLEXPORT const Mat4& getMatrix() const; //! Calculates a point in world coordinates from a point in local drawing //! coordinates by applying rotation, scaling and translation DLLEXPORT Vec3 applyWorldTransformation( const Vec3& modelPos) const; }; } // namespace Framework