IonicWind Software

IWBasic => 3D Programming => Topic started by: barry on August 26, 2007, 09:31:09 AM

Title: Just to get things started
Post by: barry on August 26, 2007, 09:31:09 AM
I felt like someone should say something to get things going in here.

I haven't had a chance to do anything with the 3D yet, other than to try out the samples.  They all work fine.

Has anyone taken a closer look and found that you can, or can't, use the Aurora 3D docs with EBasic's 3D?  Hopefully they'll get me started till the regular docs are available.

I did find that by putting a copy of the Aurora 3D help into the EBasic help folder and renaming it to 3dguide.chm the Ebasic help item will call them up.  But I haven't had a chance to see if they actually correspond to what I see in the samples yet.

Barry
Title: Re: Just to get things started
Post by: ts-soft on August 26, 2007, 10:15:37 AM
   
The Aurora 3D assistance should be sufficient for the time being. I have also no Aurora knowledge, however one of the missing examples to eBasic translated, without problems in few minutes.

"test_lights.eba"
'Arrow keys to move camera.
'PgUp/PgDn to pan up and down.
'Z and X to rotate on Z axis.

'$Define FULLSCREEN

Declare Import, Sleep (dwMilliseconds:INT)
Declare Import, timeGetTime(),INT

CONST DIK_UP = 0xC8 /* UpArrow on arrow keypad */
CONST DIK_PRIOR = 0xC9 /* PgUp on arrow keypad */
CONST DIK_LEFT = 0xCB /* LeftArrow on arrow keypad */
CONST DIK_RIGHT = 0xCD /* RightArrow on arrow keypad */
CONST DIK_END = 0xCF /* End on arrow keypad */
CONST DIK_DOWN = 0xD0 /* DownArrow on arrow keypad */
CONST DIK_NEXT = 0xD1 /* PgDn on arrow keypad */
CONST DIK_Z = 0x2C
CONST DIK_X = 0x2D
CONST DIK_R = 0x13
CONST DIK_ESCAPE = 0x01

C3DScreen s
C3DCamera c
C3DMesh m
C3DObject scene, trans
C3DLight light

FLOAT fadjust, fTarget

'target 60FPS for camera movement
fTarget = 1.0f / /*FPS*/60.0f * 1000.0f
fAdjust = 1.0f

$IfDef FULLSCREEN
s.CreateFullScreen(800, 600, 32, True)
$Else
s.CreateWindowed(0, 0, 800, 600, @CAPTION|@SIZE, "Light Example - ESC exits", NULL, False)
$EndIf

c.Create(s)
c.Position(0, 0, -10)
c.Orient(0, 0, 1, 0, 1, 0)
c.SetBackPlane(10000)

s.Clear(RGBA(0, 0, 0, 255))
s.BeginScene(c)
s.RenderText(0, 10, "Loading objects...", RGBA(255, 255, 0, 255))
s.RenderScene()

m.CreateSphere(s, 25, 2, false)
m.EnableLighting(true)

trans.CreateTransform(s)
light.Create(s, LIGHT_SPOT, 1)
light.Position(0, 0, -120)
light.SetAttenuation(0, 1/100.0, 0)
trans.AddChild(light)

scene.CreateScene(s)
scene.AddChild(trans)
scene.AddChild(m)

INT fps : fps = 0
INT startTime

Do

startTime = timeGetTime()
'check for keys and move camera accordingly
If KeyDown(DIK_UP) Then _
c.Move(0.0f, 1f * fAdjust)
If KeyDown(DIK_DOWN) Then _
c.Move(0.0f, -1f * fAdjust)
If KeyDown(DIK_RIGHT) Then _
c.Rotate(1 * .01745 * fAdjust, 0, 0)
If KeyDown(DIK_LEFT) Then _
c.Rotate(-1 * .01745 * fAdjust, 0, 0)
If KeyDown(DIK_Z) Then _
c.Rotate(0, 0, -1 *.01745 * fAdjust)
If KeyDown(DIK_X) Then _
c.Rotate(0, 0, 1 * .01745 * fAdjust)
If KeyDown(DIK_PRIOR) Then _
c.Rotate(0, -1 * .01745 * fAdjust, 0)
If KeyDown(DIK_NEXT) Then _
c.Rotate(0, 1 * .01745 * fAdjust, 0)
If KeyDown(DIK_R) Then _
c.LookAt(0, 0, 10000)

s.Clear(RGBA(128, 128, 128, 255))
s.BeginScene(c)
trans.Rotate(0, timeGetTime()/1000.0f, 0)
scene.Draw()
s.RenderText(0, 10, "FPS:" + Str$(fps), RGBA(255, 255, 0, 255))
s.RenderText(0, 30, "Use arrow keys to move around", RGBA(255, 255, 0, 255))
fps = s.RenderScene()
fAdjust = (timeGetTime() - startTime) / fTarget

$IFNDEF FULLSCREEN
Sleep(5)
$ENDIF

Until KeyDown(DIK_ESCAPE)

Scene.Free()


greetings
Thomas

(translated with google  :-[
Title: Re: Just to get things started
Post by: Ionic Wind Support Team on August 26, 2007, 10:28:00 AM
Conversion is relatively easy.  The class methods are identical, it is just the syntax and built in commands that are different.

Generally speaking you have to:

1.  Remove the main() { } tags from around the code
2.  Remove all ';' and combine lines if necessary.
3.  Change all // to '
4.  Rename command names, like NumToStr to STR$
5. Remove { } from other blocks, adding ENDWHILE, ENDIF, etc as needed.
6. Convert pointer syntax to Emergence if needed....

m->Rotate(0,timeGetTime() / 1000.0f,0);

becomes

*<C3DMesh>m.Rotate(0,timeGetTime() / 1000.0f,0)

Paul.
Title: Problem compiling example
Post by: Brian on August 26, 2007, 12:30:59 PM
Hi,

I get this message when trying to compile custom_mesh from the 3d examples:

Compiling...
custom_mesh.eba
No Errors

Linking...
Emergence Linker v1.11 Copyright ÂÃ,© 2006 Ionic Wind Software
Unresolved external _window_list
Error: Unresolved extern _window_list
Error(s) in linking C:\Program Files\EBDev\projects\3D samples\custom_mesh.exe

Brian
Title: Re: Problem compiling example
Post by: Brice Manuel on August 26, 2007, 12:36:13 PM
Are you SURE you are selecting a Windows EXE as the compile target?
Title: Re: Just to get things started
Post by: Brian on August 27, 2007, 12:17:27 PM
Whoops - egg on face! OK now, thanks Bryce

Brian
Title: Re: Just to get things started
Post by: Brice Manuel on August 27, 2007, 01:12:46 PM
Quote from: Brian Pugh on August 27, 2007, 12:17:27 PM
Whoops - egg on face! OK now, thanks Bryce

Brian
Don't sweat it.  Anybody who says they never made that same mistake is lying.  We have all done it.   ;D
Title: Re: Just to get things started
Post by: LarryMc on August 27, 2007, 01:26:39 PM
I've NEVER done that!
Well....maybe once.... :o
or twice...... ::)
or a bunch of times. :'(

Larry
Title: Re: Just to get things started
Post by: J B Wood (Zumwalt) on August 28, 2007, 09:58:07 AM
I've done it almost every time.
I say almost because when I haven't done it is when I was in something else at the time.
Granted, I am a klutz.
Title: Re: Just to get things started
Post by: barry on August 28, 2007, 01:27:28 PM
I do it all the time, too.  It would sure be nice to have a directive in the file to handle that.

Barry
Title: Re: Just to get things started
Post by: pistol350 on August 30, 2007, 06:00:03 PM
QuoteConversion is relatively easy.  The class methods are identical, it is just the syntax and built in commands that are different.

Generally speaking you have to:

1.  Remove the main() { } tags from around the code
2.  Remove all ';' and combine lines if necessary.
3.  Change all // to '
4.  Rename command names, like NumToStr to STR$
5. Remove { } from other blocks, adding ENDWHILE, ENDIF, etc as needed.
6. Convert pointer syntax to Emergence if needed....

m->Rotate(0,timeGetTime() / 1000.0f,0);

becomes

*<C3DMesh>m.Rotate(0,timeGetTime() / 1000.0f,0)

Paul.

I am sure that somebody is thinking about writing a quick converter from Aurora to Ebasic syntax as (Bevets, I think) did for Ibasic std to Ibasic pro.

PS : RIP Steeve  :-[

Regards!
Peter