123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- #ifndef Model2D_H
- #define Model2D_H
- #include "Welt2D.h"
- #include "Punkt.h"
- #include "Array.h"
- #include "DreieckListe.h"
- #include "Vec3.h"
- #include <functional>
- #include "Zeichnung.h"
- namespace Framework
- {
- class Textur2D;
-
-
- struct Polygon2D
- {
- bool transparent;
- Text *name;
- Array< Vertex > *vertex;
- Array< Vertex > *tKordinaten;
- Vertex *schwerpunkt;
- };
-
- class Model2DData
- {
- private:
- RCArray< Array< Punkt > > outList;
- int ref;
-
-
-
- bool istPunktInnen( Vertex p, int polygonId = -1 ) const;
-
-
-
- bool istLinieInnen( Vertex a, Vertex b, int polygonId = -1 ) const;
- public:
- Array< Polygon2D > *polygons;
- RCArray< RCArray< DreieckListe< Vertex > > > *vListen;
- Punkt minP, maxP;
-
- __declspec( dllexport ) Model2DData();
-
- __declspec( dllexport ) ~Model2DData();
-
-
-
- __declspec( dllexport ) bool erstelleModell( Array< Polygon2D > *polygons );
-
- __declspec( dllexport ) void removeModell();
-
-
-
-
-
-
-
-
- __declspec( dllexport ) bool calcHitPoint( Vertex pos, Vertex dir, const char *polygonName, Vertex &hitpoint, Vertex &moveSpeed, float &rotSpeed ) const;
-
-
-
-
-
-
-
-
-
- __declspec( dllexport ) bool split( Vertex pos, Vertex dir, char *polygonName, Polygon2D &partA, Polygon2D &partB, Punkt &posA, Punkt &posB, std::function< double() > random ) const;
-
- __declspec( dllexport ) float getMasse() const;
-
-
- __declspec( dllexport ) Model2DData *getThis();
-
-
- __declspec( dllexport ) Model2DData *release();
- };
- class Model2DObject : public Object2D
- {
- private:
- Model2DData * rData;
- RCArray< Textur2D > *textur;
- public:
-
- __declspec( dllexport ) Model2DObject();
-
- __declspec( dllexport ) virtual ~Model2DObject();
-
-
- __declspec( dllexport ) void setModel( Model2DData *mdl );
-
-
- __declspec( dllexport ) void setTextur( Textur2D *t );
-
-
-
- __declspec( dllexport ) void setTextur( Textur2D *t, const char *polygonName );
- __declspec( dllexport ) void impuls( Vertex start, Vertex speed, float strength = 1.f ) override;
-
-
- __declspec( dllexport ) void render( Mat3< float > &kamMat, Bild &zRObj, const char *kamName ) override;
-
-
- __declspec( dllexport ) bool istPunktInnen( Vertex p ) const override;
-
-
-
- __declspec( dllexport ) bool istLinieInnen( Vertex a, Vertex b ) const override;
-
-
-
-
- __declspec( dllexport ) virtual bool istModelInnen( const Object2D *zObj, Vertex *sp = 0, bool end = 0 ) const;
- __declspec( dllexport ) Rect2< float > getBoundingBox() const override;
-
-
-
-
-
- __declspec( dllexport ) bool calcHitPoint( Vertex pos, Vertex dir, Vertex &hitpoint ) const override;
- __declspec( dllexport ) float getLuftWiederstand() const override;
-
- __declspec( dllexport ) float getMasse() const override;
-
- __declspec( dllexport ) Textur2D *getTextur() const;
-
-
- __declspec( dllexport ) Textur2D *getTextur( const char *polygonName ) const;
-
- __declspec( dllexport ) Textur2D *zTextur() const;
-
-
- __declspec( dllexport ) Textur2D *zTextur( const char *polygonName ) const;
-
- __declspec( dllexport ) Model2DData *getModel() const;
-
- __declspec( dllexport ) Model2DData *zModel() const;
- };
-
- class Model2D : public Zeichnung
- {
- public:
- class Style : public Zeichnung::Style
- {
- public:
- const static __int64 Textur = 0x8;
- const static __int64 Rahmen = 0x10;
- const static __int64 Alpha = 0x40;
- const static __int64 Mesh = 0x20;
- };
- private:
- Model2DData *rData;
- float drehung;
- float size;
- int farbe;
- RCArray< Textur2D > *textur;
- public:
-
- __declspec( dllexport ) Model2D();
-
- __declspec( dllexport ) virtual ~Model2D();
-
-
- __declspec( dllexport ) void setModel( Model2DData *mdl );
-
-
- __declspec( dllexport ) void setDrehung( float drehung );
-
-
- __declspec( dllexport ) void addDrehung( float drehung );
-
-
- __declspec( dllexport ) void setSize( float size );
-
-
- __declspec( dllexport ) void addSize( float size );
-
-
- __declspec( dllexport ) void setTextur( Textur2D *t );
-
-
-
- __declspec( dllexport ) void setTextur( Textur2D *t, const char *polygonName );
-
-
- __declspec( dllexport ) void setFarbe( int f );
-
-
- __declspec( dllexport ) void doMausEreignis( MausEreignis &me ) override;
-
-
- __declspec( dllexport ) bool tick( double tickVal ) override;
-
-
- __declspec( dllexport ) void render( Bild &zRObj ) override;
-
- __declspec( dllexport ) float getDrehung() const;
-
- __declspec( dllexport ) float getSize() const;
-
-
- __declspec( dllexport ) bool istPunktInnen( Vertex p ) const;
-
-
-
- __declspec( dllexport ) bool istLinieInnen( Vertex a, Vertex b ) const;
-
-
-
- __declspec( dllexport ) bool istModelInnen( const Model2D *zMdl, bool end = 0 ) const;
-
- __declspec( dllexport ) Model2DData *getModel() const;
-
- __declspec( dllexport ) Model2DData *zModel() const;
- };
- }
- #endif
|