Page 1 of 1
					
				Basic 3D Shape Commands?
				Posted: Sat Sep 25, 2004 4:21 pm
				by Yerrel
				Hoi there again,
After experimenting with PureBASIC, reading the manual etc.., i have a very very important question and that is:
Is there any 3D command for making a cube or cone or triangle or other basic 3D-shapes?
If not, how do i accomplish this? like creating a Cube, Triangle, Cone, sphere and so on.
Please help me! coz i need some serious help here..
 
 
Tnx for you help..
 
			 
			
					
				
				Posted: Sat Sep 25, 2004 6:17 pm
				by LarsG
				The current implementation of OGRE doesn't support making primitives in PB.
			 
			
					
				
				Posted: Sat Sep 25, 2004 9:15 pm
				by Yerrel
				LarsG wrote:The current implementation of OGRE doesn't support making primitives in PB.
Okay!
than can you give me a example-code or any Purebasic tutorial link that i can learn from on how to make Primitives plz.. 
 
tnx
 
			 
			
					
				
				Posted: Mon Sep 27, 2004 12:31 am
				by waffle
				the simplest method that I have used is to just do them
in MS3D and export as .mesh. Then just rescale them in code.
If you do a search for a desired shape, I think there is code
for creating shapes 1 polygon at a time. I'm sure I saw one for
spheres, cubes and planes are simple to construct.
edit:
Well, I did a search and the best I came up with was this...
viewtopic.php?t=10893
It shows how to load an MS3D ascii file. From this,
you should be able to see how vertexes are aranged and
polygons connected.
 
			 
			
					
				
				Posted: Mon Sep 27, 2004 8:50 pm
				by Erlend
				Hi Yerrel
This can hopefully help you somewhat...
http://home.c2i.net/PreachersPlace/Pure ... ibrary.zip
My docs are not in the best of states, but there is a example that is quite explaining, would be very interested in feedback.
Erlend "Preacher" Rovik
 
			 
			
					
				
				Posted: Wed Sep 29, 2004 7:44 am
				by Yerrel
				
Hoi Erlend,
It must be great if it only could work. 
 
But nothing happens when i run it!
Worse, i get the following error:
Line 25: QVertex() is not a function, an array or a linked list.  
 
Is it something that i have to do? like putting the required library somewhere? or need to Dload the needed Library?
Hope u can correct or guide me with this problem...
tnx,
Yerrel
 
			 
			
					
				
				Posted: Wed Sep 29, 2004 4:32 pm
				by olejr
				You have to put the QMesh lib (in the archive)
into purelibraries\userlibraries...
			 
			
					
				
				Posted: Fri Oct 01, 2004 11:21 pm
				by Yerrel
				olejr wrote:You have to put the QMesh lib (in the archive)
into purelibraries\userlibraries...
Done that and the examples do execute.  
 
But i still don't understand it at all..  

 ... Cozx i am a real beginner @ PureBASIC ( programming ).
Coz i am looking for something like Createcube() or like Make Cube).
Your library seems to be okay if u could only type just a little documention about how to use it etc...
....
Yerrel
 
			 
			
					
				
				Posted: Mon Oct 04, 2004 9:53 am
				by olejr
				Example. Here I use only 
QCube()(create a cube..). Don't ask me what else the
librarys does, I don't use it... 
 
 This is a result of 2 minutes of reading through the code..
As he (Erlend) say at the top of the source: 
Best way to learn/understand is to test and modify
Code: Select all
;Example for the QMesh Lib.
;Best way to learn/understand is to test and modify, so enjoy...... 
; Erlend "Preacher" Rovik
;Simplified to show QCube() by olejr
;textures are in the original QMesh archive..
image.s="qmesh_texture.jpg"; remember sizes 64*64 128*128 etc.
earth.s="earth.jpg"
cube.s="cube.jpg"
#CameraSpeed = 1
DefType.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If OpenWindow(0,0,0,300,300,#PB_Window_SystemMenu,"Example")
     OpenWindowedScreen(WindowID(), 0, 0, 300,300, 0, 0, 0)
    
    ;These 3 lines are for createing the Cube
    QCube()
    QObject(5)
    CreateEntity(5, MeshID(5), CreateMaterial(5, LoadTexture(5,cube)))
    ; Then setup Camera and put it in place
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0,0,0,20)
    
    Repeat
      ;Everything here is for rotating mesh (cube)/ Moving Camera 
      ClearScreen(0, 0, 0)
      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_Left)
          KeyX = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Right)
          KeyX = #CameraSpeed 
        Else
          KeyX = 0
        EndIf
                  
        If KeyboardPushed(#PB_Key_Up)
          KeyY = -#CameraSpeed 
        ElseIf KeyboardPushed(#PB_Key_Down)
          KeyY = #CameraSpeed 
        Else
          KeyY = 0
        EndIf
      EndIf
      If ExamineMouse()
        MouseX = -(MouseDeltaX()/10)*#CameraSpeed/2
        MouseY = -(MouseDeltaY()/10)*#CameraSpeed/2
      EndIf
      RotateEntity(5, 0.4, 0.4, 0.4)
      RotateCamera(0, MouseX, MouseY, RollZ)
      MoveCamera  (0, KeyX, 0, KeyY)
      
      ;Here we render (draw) the world
      RenderWorld()
      FlipBuffers()
      Delay(3)
      
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
EndIf
 
			 
			
					
				
				Posted: Mon Oct 04, 2004 10:22 am
				by Yerrel
				[quote="olejr"]Example. Here I use only 
QCube()(create a cube..). Don't ask me what else the
librarys does, I don't use it... 
 
 This is a result of 2 minutes of reading through the code..
As he (Erlend) say at the top of the source: 
Best way to learn/understand is to test and modify
Code: Select all
;Example for the QMesh Lib.
;Best way to learn/understand is to test and modify, so enjoy...... 
; Erlend "Preacher" Rovik
;Simplified to show QCube() by olejr
Okay thanks Olejr  :wink: 
Bcoz of work i can't hardly find time to do some heavy reading or xperimenting.. But time will come to dig into PureBASIC..
Diz code is clear as dunnow what  :D 
Now i understand the Qmesh Lib...
tanx 2 all