Jump to content



Photo

A 3d Engine For Cplua !


  • Please log in to reply
4 replies to this topic

#1 Major

Major

    Newbie

  • Members
  • Pip
  • 17 posts
  • Location:Toulouse, France.

  • Calculators:
    Classpad 300

Posted 16 May 2006 - 05:07 PM

Hello everybody !

I just can't resist the temptation to speak about my current project : A graphic engine which can be used to manipulate and display any kind of 3D objects ! :D
I hope that people will be able to use it when developping some new games or 3D applications !
It's been a while now since Tchernoben and I started to work on this project and it is still in constant development. :)
There is a lot of work to do, and I must offer many thanks to Tchernoben for his useful help in this great project !


Posted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted Image

Here some of the basic functions of the engine :

obj = td.new_point ( x, y, z )  -- Addition of a new point to the scene with co-ordinates x, y, z.
									 
  obj = td.new_cube ( x, y, z, c ) -- Creation of a cube of center {x,y,z} and of with dimensions c.
									  
  obj = td.new_tetrahedron ( x, y, z, c ) -- Creation of a tetrahedron of center {x,y,z} and of with dimensions c.
											
  obj = td.new_plane ( x, y, z) -- Creation of a plane of center {x,y,z} and of with dimension c.

  cam = td.new_cam ( x1, y1, z1, x2, y2, z2 ) -- Camera settings.

  td.translation ( obj , x, y, z ) -- Translation of an object using a vector of co-ordinates x, y and z.
									 
  td.projection ( obj , p )  -- Central projection of an object.
								   
  td.scale ( obj , x, y, z ) -- Scaling of an object.
								   
  td.rotation_x ( obj , r )  -- Rotation of an object around the axis (X) according to an angle r.
								   
  td.rotation_y ( obj , r )  -- Rotation of an object around the axis (Y) according to an angle r.
								   
  td.rotation_z ( obj , r )  -- Rotation of an object around the axis (Z) according to an angle r.
								   
  td.draw_object ( obj , cam, prospect ) -- Draw an object.

I awaits impatiently your remarks and suggestions!



#2 Meithal

Meithal

    Newbie

  • Members
  • Pip
  • 21 posts

  • Calculators:
    G35+
    Cp300

Posted 22 May 2006 - 09:19 PM

Tr?s sympa, j'attends de voir la suite :)

Par contre, il vaudrait mieux s'exprimer en anglais. Tout le monde ne comprend pas le francais ici.

---

Very cool, I'm waiting to see the next :)

#3 Major

Major

    Newbie

  • Members
  • Pip
  • 17 posts
  • Location:Toulouse, France.

  • Calculators:
    Classpad 300

Posted 28 June 2006 - 12:14 AM

Very cool, I'm waiting to see the next :)

Hello, I am back !

I am pleased to announce to you that the preversion of the engine 3d will be soon available !
As in the example below, you will be able to display a tetrahedron and a cube in prospect and to move them in space using the buttons of the Casio.

The possibilities of creating a scene will be vast, in fact, I hope that the only limit will be your imagination ! ^_^

I seek people to model a Stargate and his DHD as exemple of the motor, for the amateurs of course ! ;)

pi = math.pi

require("draw")
require("Engine/lib")

showgraph ()
fullscreen (0)
keypad (0)
draw.onbuffer ()

cam = td.new_camera (0,0,0,0,0,500)
cube = td.new_cube (0,0,-50,10)
tetra  = td.new_tetrahedron (0,0,-50,10)

repeat

if testkey (K_LEFT)  then td.translation (cube,0.1,0,0)
						  td.translation (tetra,0.1,0,0)  end
						  
if testkey (K_RIGHT) then td.translation (cube,-0.1,0,0)
						  td.translation (tetra,-0.1,0,0)  end
						  
if testkey (K_UP)	then td.translation (cube,0,0.1,0)
						  td.translation (tetra,0,0.1,0)  end
						  
if testkey (K_DOWN)  then td.translation (cube,0,-0.1,0)
						  td.translation (tetra,0,-0.1,0)  end
						  
if testkey (K_BACK)  then td.translation (cube,0,0,0.1)
						  td.translation (tetra,0,0,0.1)  end
						  
if testkey (K_EXE)   then td.translation (cube,0,0,-0.1)
						  td.translation (tetra,0,0,-0.1)  end

td.draw_object (cube,cam,1)
td.draw_object (tetra,cam,1)

draw.update ()
draw.clear ()

until 0


#4 Major

Major

    Newbie

  • Members
  • Pip
  • 17 posts
  • Location:Toulouse, France.

  • Calculators:
    Classpad 300

Posted 02 August 2006 - 04:58 PM

After a long idle period, I finally recovered to the programming from the engine 3d. In order to test its performances, I modelled the vessel Prometeus of Stargate and animated it in the engine.


Posted Image

Result: the classpad does not seem powerful enough, and when the camera exceeds the object, bug may occur. Those who works in 3D knows what i'm talking , and whom it is advisable to employ the method of the clipping to resolve this problem. I hope to remove the bugs and to increase the speed of execution of the program by posting only the points being located in the field of vision of the camera, reducing thus enormously the number of calculation to be carried out.

Posted Image Posted Image



#5 Tchernoben

Tchernoben

    Casio Fan

  • Members
  • PipPip
  • 42 posts
  • Location:Nice
  • Interests:Calculators, Pc, mangas, warhammer.

  • Calculators:
    Classpad 300
    Ti 89 Titanium

Posted 02 August 2006 - 05:57 PM

seems great :)

for a faster engine you should work with Lua object oriented programming (read the manual)
you can get rid of this easily by using the "self" obect (which is not very powerfull but can be easily learned for beginers in oop)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users