Skip to content

Commit

Permalink
Added a C version of the WriteQuad and made the #ifdef in one area
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Edelman committed Jul 11, 2011
1 parent 7209a32 commit c98a73f
Show file tree
Hide file tree
Showing 6 changed files with 12,202 additions and 12,206 deletions.
Binary file modified samples/test/particleSprites/cathead.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions samples/test/particleSprites/main.lua
Expand Up @@ -22,9 +22,14 @@ texture:setTexture ( "cathead.png" )
texture:setRect ( -16, -16, 16, 16 )

system = MOAIParticleSystem.new ()
system:reserveSprites ( 256 )
system:reserveSprites ( 1000 )
system:setDeck ( texture )

system:pushSprite ( 0, 0 )
for i=1, 1000 do

x = math.random ( -320, 320 )
y = math.random ( -240, 240 )
system:pushSprite ( x, y )
end

layer:insertProp ( system )
9 changes: 9 additions & 0 deletions src/uslsext/USAffine2D.h
Expand Up @@ -414,7 +414,9 @@ class USMetaAffine2D {

template < typename PARAM_TYPE>
void TransformQuad ( USMetaVec2D < PARAM_TYPE >* quad ) const {

#ifdef MOAI_ARM7

TYPE xform_mat[16] = { m[C0_R0], m[C0_R1], 0, 0, //column 1
m[C1_R0], m[C1_R1], 0, 0, //column 2
m[C2_R0], m[C2_R1], 0, 0, //column 3
Expand Down Expand Up @@ -470,6 +472,13 @@ class USMetaAffine2D {
quad[2].mX = outpt_mat[8]; quad[2].mY = outpt_mat[9];
quad[3].mX = outpt_mat[12]; quad[3].mY = outpt_mat[13];

#else

this->Transform ( quad [ 0 ] );
this->Transform ( quad [ 1 ] );
this->Transform ( quad [ 2 ] );
this->Transform ( quad [ 3 ] );

#endif
}

Expand Down
20 changes: 1 addition & 19 deletions src/uslsext/USGLQuad.cpp
Expand Up @@ -84,26 +84,8 @@ void USGLQuad::Draw ( float xOff, float yOff, float xScale, float yScale ) {
void USGLQuad::Draw ( const USVec2D* vtx, const USVec2D* uv ) {

USDrawBuffer& drawBuffer = USDrawBuffer::Get ();

#ifdef MOAI_ARM7


drawBuffer.WriteQuad ( ( USVec2D* )vtx, ( USVec2D* )uv );

#else

drawBuffer.BeginPrim ();
USGLQuad::WriteVertex ( drawBuffer, vtx [ 3 ], uv [ 3 ]);
USGLQuad::WriteVertex ( drawBuffer, vtx [ 1 ], uv [ 1 ]);
USGLQuad::WriteVertex ( drawBuffer, vtx [ 0 ], uv [ 0 ]);
drawBuffer.EndPrim ();

drawBuffer.BeginPrim ();
USGLQuad::WriteVertex ( drawBuffer, vtx [ 3 ], uv [ 3 ]);
USGLQuad::WriteVertex ( drawBuffer, vtx [ 2 ], uv [ 2 ]);
USGLQuad::WriteVertex ( drawBuffer, vtx [ 1 ], uv [ 1 ]);
drawBuffer.EndPrim ();

#endif
}

//----------------------------------------------------------------//
Expand Down

0 comments on commit c98a73f

Please sign in to comment.