|
@@ -154,7 +154,7 @@ bool Model2DData::istLinieInnen( Vertex a, Vertex b, int polygonId ) const
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
-bool Model2DData::erstelleModell( Array< Polygon2D > *polygons )
|
|
|
+bool Model2DData::erstelleModell( Array< Polygon2D > * polygons )
|
|
|
{
|
|
|
removeModell();
|
|
|
if( !polygons || !polygons->getEintragAnzahl() )
|
|
@@ -400,7 +400,7 @@ void Model2DData::removeModell() // setzt die Vertex daten zur
|
|
|
maxP = Punkt( 0, 0 );
|
|
|
}
|
|
|
|
|
|
-bool Model2DData::calcHitPoint( Vertex pos, Vertex dir, const char *polygonName, Vertex &hitpoint, Vertex &moveSpeed, float &rotSpeed ) const
|
|
|
+bool Model2DData::calcHitPoint( Vertex pos, Vertex dir, const char *polygonName, Vertex & hitpoint, Vertex & moveSpeed, float &rotSpeed ) const
|
|
|
{
|
|
|
if( dir.x == 0 && dir.y == 0 )
|
|
|
return 0;
|
|
@@ -456,7 +456,7 @@ bool Model2DData::calcHitPoint( Vertex pos, Vertex dir, const char *polygonName,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-bool Model2DData::split( Vertex pos, Vertex dir, char *polygonName, Polygon2D &partA, Polygon2D &partB, Punkt &posA, Punkt &posB, std::function< double() > random ) const
|
|
|
+bool Model2DData::split( Vertex pos, Vertex dir, char *polygonName, Polygon2D & partA, Polygon2D & partB, Punkt & posA, Punkt & posB, std::function< double() > random ) const
|
|
|
{
|
|
|
Vertex originalDir = dir;
|
|
|
bool ret = 0;
|
|
@@ -631,8 +631,8 @@ bool Model2DData::split( Vertex pos, Vertex dir, char *polygonName, Polygon2D &p
|
|
|
partB.tKordinaten->add( polygon._.tKordinaten->get( rightI ) );
|
|
|
*partA.schwerpunkt /= (float)partA.vertex->getEintragAnzahl();
|
|
|
*partB.schwerpunkt /= (float)partB.vertex->getEintragAnzahl();
|
|
|
- posA = (Punkt)*partA.schwerpunkt;
|
|
|
- posB = (Punkt)*partB.schwerpunkt;
|
|
|
+ posA = (Punkt)* partA.schwerpunkt;
|
|
|
+ posB = (Punkt)* partB.schwerpunkt;
|
|
|
for( int i = 0; i < partA.vertex->getEintragAnzahl(); i++ )
|
|
|
partA.vertex->set( partA.vertex->get( i ) - *partA.schwerpunkt, i );
|
|
|
for( int i = 0; i < partB.vertex->getEintragAnzahl(); i++ )
|
|
@@ -670,7 +670,7 @@ float Model2DData::getMasse() const
|
|
|
}
|
|
|
|
|
|
// Reference Counting
|
|
|
-Model2DData *Model2DData::getThis()
|
|
|
+Model2DData * Model2DData::getThis()
|
|
|
{
|
|
|
ref++;
|
|
|
return this;
|
|
@@ -704,14 +704,14 @@ Model2DObject::~Model2DObject()
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
-void Model2DObject::setModel( Model2DData *mdl )
|
|
|
+void Model2DObject::setModel( Model2DData * mdl )
|
|
|
{
|
|
|
if( rData )
|
|
|
rData->release();
|
|
|
rData = mdl;
|
|
|
}
|
|
|
|
|
|
-void Model2DObject::setTextur( Textur2D *t )
|
|
|
+void Model2DObject::setTextur( Textur2D * t )
|
|
|
{
|
|
|
int index = 0;
|
|
|
if( rData )
|
|
@@ -758,7 +758,7 @@ void Model2DObject::impuls( Vertex start, Vertex speed, float strength )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Model2DObject::setTextur( Textur2D *t, const char *polygonName )
|
|
|
+void Model2DObject::setTextur( Textur2D * t, const char *polygonName )
|
|
|
{
|
|
|
int index = 0;
|
|
|
for( auto i = rData->polygons->getIterator(); i; i++, index++ )
|
|
@@ -769,7 +769,7 @@ void Model2DObject::setTextur( Textur2D *t, const char *polygonName )
|
|
|
t->release();
|
|
|
}
|
|
|
|
|
|
-void Model2DObject::render( Mat3< float > &kamMat, Bild &zRObj, const char *kamName )
|
|
|
+void Model2DObject::render( Mat3< float > & kamMat, Bild & zRObj, const char *kamName )
|
|
|
{
|
|
|
if( !rData || !rData->polygons || !textur )
|
|
|
return;
|
|
@@ -787,9 +787,9 @@ void Model2DObject::render( Mat3< float > &kamMat, Bild &zRObj, const char *kamN
|
|
|
Vertex a = mat * *j->punkt;
|
|
|
Vertex b = mat * *j.next()->punkt;
|
|
|
Vertex c = mat * *j.next().next()->punkt;
|
|
|
- Punkt ta = (Punkt)Vertex( j->textur->x * (float)txt->getBreite(), j->textur->y * (float)txt->getHeight() );
|
|
|
- Punkt tb = (Punkt)Vertex( j.next()->textur->x * (float)txt->getBreite(), j.next()->textur->y * (float)txt->getHeight() );
|
|
|
- Punkt tc = (Punkt)Vertex( j.next().next()->textur->x * (float)txt->getBreite(), j.next().next()->textur->y * (float)txt->getHeight() );
|
|
|
+ Punkt ta = (Punkt)Vertex( j->textur->x * (float)( txt->getBreite() - 1 ), j->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
+ Punkt tb = (Punkt)Vertex( j.next()->textur->x * (float)( txt->getBreite() - 1 ), j.next()->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
+ Punkt tc = (Punkt)Vertex( j.next().next()->textur->x * (float)( txt->getBreite() - 1 ), j.next().next()->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
zRObj.drawDreieckTexturAlpha( a, b, c, ta, tb, tc, *txt );
|
|
|
}
|
|
|
}
|
|
@@ -893,7 +893,7 @@ bool Model2DObject::istLinieInnen( Vertex a, Vertex b ) const
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-bool Model2DObject::istModelInnen( const Object2D *zObj, Vertex *sp, bool end ) const
|
|
|
+bool Model2DObject::istModelInnen( const Object2D * zObj, Vertex * sp, bool end ) const
|
|
|
{
|
|
|
if( !end )
|
|
|
{
|
|
@@ -924,11 +924,11 @@ bool Model2DObject::istModelInnen( const Object2D *zObj, Vertex *sp, bool end )
|
|
|
Rect2< float > Model2DObject::getBoundingBox() const
|
|
|
{
|
|
|
if( rData )
|
|
|
- return Rect2< float >{ (Vertex)rData->minP * size + position, (Vertex)rData->maxP * size + position };
|
|
|
+ return Rect2< float >{ (Vertex)rData->minP *size + position, (Vertex)rData->maxP *size + position };
|
|
|
return Rect2< float >();
|
|
|
}
|
|
|
|
|
|
-bool Model2DObject::calcHitPoint( Vertex pos, Vertex dir, Vertex &hitpoint ) const
|
|
|
+bool Model2DObject::calcHitPoint( Vertex pos, Vertex dir, Vertex & hitpoint ) const
|
|
|
{
|
|
|
pos = getObjectPos( pos );
|
|
|
dir = getObjectDir( dir );
|
|
@@ -1070,7 +1070,7 @@ Model2D::~Model2D()
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
-void Model2D::setModel( Model2DData *mdl )
|
|
|
+void Model2D::setModel( Model2DData * mdl )
|
|
|
{
|
|
|
if( rData )
|
|
|
rData->release();
|
|
@@ -1109,7 +1109,7 @@ void Model2D::addSize( float size )
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
-void Model2D::setTextur( Textur2D *t )
|
|
|
+void Model2D::setTextur( Textur2D * t )
|
|
|
{
|
|
|
int index = 0;
|
|
|
if( rData )
|
|
@@ -1120,7 +1120,7 @@ void Model2D::setTextur( Textur2D *t )
|
|
|
t->release();
|
|
|
}
|
|
|
|
|
|
-void Model2D::setTextur( Textur2D *t, const char *polygonName )
|
|
|
+void Model2D::setTextur( Textur2D * t, const char *polygonName )
|
|
|
{
|
|
|
int index = 0;
|
|
|
for( auto i = rData->polygons->getIterator(); i; i++, index++ )
|
|
@@ -1137,7 +1137,7 @@ void Model2D::setFarbe( int f )
|
|
|
rend = 1;
|
|
|
}
|
|
|
|
|
|
-void Model2D::doMausEreignis( MausEreignis &me )
|
|
|
+void Model2D::doMausEreignis( MausEreignis & me )
|
|
|
{
|
|
|
if( !mak || me.verarbeitet || !istPunktInnen( Punkt( me.mx, me.my ) ) )
|
|
|
return;
|
|
@@ -1156,7 +1156,7 @@ bool Model2D::tick( double tickVal )
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-void Model2D::render( Bild &zRObj )
|
|
|
+void Model2D::render( Bild & zRObj )
|
|
|
{
|
|
|
if( !rData || hatStyleNicht( Model2D::Style::Sichtbar ) || !rData->polygons )
|
|
|
return;
|
|
@@ -1193,9 +1193,9 @@ void Model2D::render( Bild &zRObj )
|
|
|
Vertex a = mat * *j->punkt;
|
|
|
Vertex b = mat * *j.next()->punkt;
|
|
|
Vertex c = mat * *j.next().next()->punkt;
|
|
|
- Punkt ta = (Punkt)Vertex( j->textur->x * (float)txt->getBreite(), j->textur->y * (float)txt->getHeight() );
|
|
|
- Punkt tb = (Punkt)Vertex( j.next()->textur->x * (float)txt->getBreite(), j.next()->textur->y * (float)txt->getHeight() );
|
|
|
- Punkt tc = (Punkt)Vertex( j.next().next()->textur->x * (float)txt->getBreite(), j.next().next()->textur->y * (float)txt->getHeight() );
|
|
|
+ Punkt ta = (Punkt)Vertex( j->textur->x * (float)( txt->getBreite() - 1 ), j->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
+ Punkt tb = (Punkt)Vertex( j.next()->textur->x * (float)( txt->getBreite() - 1 ), j.next()->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
+ Punkt tc = (Punkt)Vertex( j.next().next()->textur->x * (float)( txt->getBreite() - 1 ), j.next().next()->textur->y * (float)( txt->getHeight() - 1 ) );
|
|
|
if( hatStyle( Model2D::Style::Alpha ) )
|
|
|
zRObj.drawDreieckTexturAlpha( a, b, c, ta, tb, tc, *txt );
|
|
|
else
|
|
@@ -1340,7 +1340,7 @@ bool Model2D::istLinieInnen( Vertex a, Vertex b ) const
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-bool Model2D::istModelInnen( const Model2D *zMdl, bool end ) const
|
|
|
+bool Model2D::istModelInnen( const Model2D * zMdl, bool end ) const
|
|
|
{
|
|
|
if( !end )
|
|
|
{
|