Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


simple software renderer, behold glorious 3d

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Binaries
View previous topic :: View next topic  
Author Message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5804

PostPosted: Thu Apr 01, 2010 8:28 pm    Post subject: simple software renderer, behold glorious 3d Reply with quote

...barely, it's about as simple as you can hope to get.

Line drawing is bugged atm and seems to mysteriously break so it's still just pure verticies. Later comes a reworking of an .obj file loader so I can stop doing models by hand.

Use the arrow keys to rotate it!

http://www.mediafire.com/?mmk2u23jnjt
Back to top
View user's profile Send private message
Womanizer
Grandmaster Cheater
Reputation: 2

Joined: 30 May 2009
Posts: 960

PostPosted: Fri Apr 02, 2010 5:46 am    Post subject: Reply with quote

Nice man, but sadly there are only dots.

Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5804

PostPosted: Wed Apr 07, 2010 1:50 am    Post subject: Reply with quote

i'm bad at SSE, this took me longer to work out than i'd like to admit

it seems right, fun exercise either way


Code:
void GFX_Vec_Mul(Vector* out, Vector* v, Matrix* m)
{   
   __m128 vx = _mm_shuffle_ps(v->v128, v->v128, 0x00);
   __m128 vy = _mm_shuffle_ps(v->v128, v->v128, 0x55);
   __m128 vz = _mm_shuffle_ps(v->v128, v->v128, 0xAA);   

   vx = _mm_mul_ps(vx, m->m128[0]);
   vy = _mm_mul_ps(vy, m->m128[1]);
   vz = _mm_mul_ps(vz, m->m128[2]);

   vx         = _mm_add_ps(vx, vy);
   vx         = _mm_add_ps(vx, vz);
   out->v128   = _mm_add_ps(vx, m->m128[3]);
}
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5804

PostPosted: Fri Apr 09, 2010 3:56 am    Post subject: Reply with quote

wow, i spent a good fucking chunk of time trying to wrap my head around why my function wasn't working right. after walking through it step by step a few times i came to realize that it was fucking up because i had brilliantly mixed up my matricies.

'm2' should have been 'm1' and vice-versa

the best part was the end result seemed right until i tried to move it... and it still was right, kinda. it kept its shape fine, it just moved "weird". i kinda want to slam my head on the desk right now, not my finest moment.


Code:
int i;
for(i = 0; i < 4; i++)
{
   __m128 s0 = _mm_shuffle_ps(m1->m128[i], m1->m128[i], 0x00);
   __m128 s1 = _mm_shuffle_ps(m1->m128[i], m1->m128[i], 0x55);
   __m128 s2 = _mm_shuffle_ps(m1->m128[i], m1->m128[i], 0xAA);
   __m128 s3 = _mm_shuffle_ps(m1->m128[i], m1->m128[i], 0xFF);

   s0 = _mm_mul_ps(s0, m2->m128[0]);
   s1 = _mm_mul_ps(s1, m2->m128[1]);
   s2 = _mm_mul_ps(s2, m2->m128[2]);
   s3 = _mm_mul_ps(s3, m2->m128[3]);

   s0            = _mm_add_ps(s0, s1);
   s0            = _mm_add_ps(s0, s2);
   out->m128[i]   = _mm_add_ps(s0, s3);
}


maybe manually unroll it if you're feeling spunky.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Binaries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites