• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

N3xtD - Free 3D engine

Started by Brice Manuel, August 25, 2011, 06:40:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Peter Weis

Today it is still what git :'(


' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  020   as  VolumeLight test
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#INCLUDE "N3xtD.bi"

FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER
    DIM i AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF


    '----------------------------------------
    ' Create volume light And set position
    DIM vlight AS VolumeLightNode
    vlight = CreateVolumeLight(0, &h000ffffff, 32,32, %NULL )
    ScaleNode(vlight, 100.0, 100.0, 100.0)
    PositionNode(vlight, -85,50,40)

    ' Import all the bmp file For animation
    DIM texturelist AS NArray
    texturelist = CreateArray()
    DIM portal AS NTexture

    FOR  i = 1 TO 7
        DIM nname AS STRING
        nname = "media/portal"+TRIM$(STR$(i)+".bmp")
        portal = LoadTexture( (nname))
        PushbackArray( texturelist,  BYVAL portal)
    NEXT

    ' define And Create Texture animator
    DIM anim AS NNodeAnimator
    anim = CreateTextureAnimator( texturelist,  100, %TRUE)
    ' add inside the node (here vlight) the animator (Texture animator)
    AddAnimatorTexture(vlight, anim)





    '----------------------------------------
    '----------------------------------------
    ' Load 3D objects
    DIM obj AS Mesh
    obj = LoadMesh("media/room.3ds", %HARDMAPPING.EHM_STATIC)
    ' change planar texture mapping on the mesh
    MakePlanarTextureMappingMesh(obj, 0.004)
    '----------------------------------------
    ' Create ROOM
    DIM room AS EntityNode
    room = CreateEntityNode(obj, 0, 0, 0, %NULL)
    ' Load two textures
    DIM colormap AS NTexture
    colormap = LoadTexture( "media/wall0.jpg")
    ' set texture in the New room (room2)
    MaterialTextureNode(room, colormap , 0)
    ' set material For room parallax mapping
    DIM material AS NMaterial
    material = NodeMaterial(room, 0)
    SpecularColorMaterial(material, 0)
    '----------------------------------------



    '----------------------------------------
    '----------------------------------------
    '----------------------------------------
    ' Create PARTICLE SYSTEM
    DIM part AS ParticleSystemNode
    part = CreateParticleSystem(%FALSE, %NULL)
    ' Create a box particle emitter
    DIM cyl_emitter AS ParticleEmitter
    cyl_emitter = CreateParticleCylinderEmitter(part, 0, 0.3, 0, 100, 0, 1, 0, 300, %False, 0, 0.03, 0, 15, 30, &h0ff000000, &h0ffffffff, 2000, 4000, 0, _
        5.0, 5.0, 5.0, 5.0)

    ' change SizeOf each particle inside the particle emitter
    MinStartSizeParticle(cyl_emitter,  10.0, 10.0  )
    MaxStartSizeParticle(cyl_emitter,  10.0, 10.0  )
    ' add New emitter inside the particlesystem
    AddEmitterParticleSystem(part, cyl_emitter )
    ' fadeout element
    FadeOutParticleSystem(part, 0, 1000 )
    LoadTextureNode(part, "media/fireball.bmp", 0, 0)
    PositionNode(part, -50,100,0)

    DIM mat_ AS NMaterial
    mat_ = NodeMaterial(part, 0)
    TypeMaterial(mat_,  %EMT_TRANSPARENT_ADD_COLOR)
    '----------------------------------------
    ' Create traditional light And set position
    DIM light AS LightNode
    light = CreateLight(&h0ffffffff, 300, %ELT_POINT , %NULL)
    PositionNode(light, -80,130,40)





    '----------------------------------------
    ' Create a camera
    DIM cam AS CameraNode
    cam = CreateCameraFPS(80.0,  0.1, 1.0, BYVAL %NULL, 0, %False, %False, %NULL )
    PositionNode(cam, -95,155,-263)





    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()


    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit=0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF


        ' ---------------
        '      Render
        ' ---------------
        BeginScene(128,128,128, 255, 1, 1)
        DrawScene()
        EndScene()


    WEND
    ' end
    FreeEngine()
END FUNCTION
                       

Peter Weis

N3xtD.bi have changed again

Brice Manuel

Peter,

It is good to see somebody exploring gaming capabilities for PowerBASIC.  Excellent work on making N3xtD accessible to PowerB users!

Peace,

Brice

Peter Weis

Hi, I mainly have you helped the interest was not so great in the forum

Brice Manuel

That is true, there isn't a lot of interest on the forums.  Hopefully, thanks to your efforts that might change a little. ;D  Thank you for your hard work on this, I am sure it will be beneficial to others.  :)

Peter Weis

Next example

' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  021   as   Mesh particle demo.
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------
' Includes libraries
#INCLUDE "N3xtD.bi"

FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF

    '-----------------------------------------
    ' set ambient light
    AmbientLight(&h0ffaaaaaa)


    '----------------------------------------
    ' Load 3D objects
    DIM obj AS Mesh
    obj = LoadMesh("media/sphere.x", %HARDMAPPING.EHM_STATIC)


    '-----------------------------------------
    DIM sp AS EntityNode
    sp =  CreateEntityNode(obj, 0,  0, 0, %NULL)




    '----------------------------------------
    '----------------------------------------
    ' Create PARTICLE SYSTEM
    DIM part AS ParticleSystemNode
    part = CreateParticleSystem(%FALSE, %NULL )
    ' Create a box particle emitter
    DIM mesh_emitter AS ParticleEmitter
    mesh_emitter = CreateParticleMeshEmitter(part, obj, %TRUE, 0, 0.03, 0, 100,  -1, %False, 50, 100, &h00ffffff, &h000000ff, 2000, _
        4000, 0, 5.0, 5.0, 5.0, 5.0)


    ' change SizeOf each particle inside the particle emitter
    MinStartSizeParticle(mesh_emitter,  10.0, 10.0  )
    MaxStartSizeParticle(mesh_emitter,  10.0, 25.0  )
    ' add New emitter inside the particlesystem
    AddEmitterParticleSystem(part, mesh_emitter )
    ' fadeout element
    FadeOutParticleSystem( part, 0, 1000)

    ' adjust some material settings
    LoadTextureNode(part, "media/fireball.bmp", 0, 0)

    DIM mat_ AS NMaterial
    mat_ = NodeMaterial(part, 0)
    TypeMaterial(MAT_,  %EMT_TRANSPARENT_ADD_COLOR)






    '----------------------------------------
    ' Create a camera
    DIM cam AS CameraNode
    cam = CreateCamera(%Null)
    PositionNode(cam, 0,1,-120)


    '-----------------------------------
    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()



    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit = 0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit = 1
        END IF

        TurnNode(sp, 0, 0.15, 0, 0)



        ' ---------------
        '      Render
        ' ---------------
        BeginScene(128,128,128, 255, 1, 1)
        DrawScene()
        EndScene()

    WEND
    ' end
    FreeEngine()
END FUNCTION
                               

Peter Weis


' ------------------------------------------------------------
'   n3xt-D
'
'    sample 023  as       Pivot And Parent
'   Historique   as
'     07/04/09  19 as 16    by Comtois For Dreamotion3D adaptation TMyke
'     07/03/11  19 as 16    adaptation For N3xtD v2.0 by TMyke.
'
' ------------------------------------------------------------

' Includes libraries
#INCLUDE "N3xtD.bi"

'-Constantes
    %NBPivot = 4
    %NbBranche = 7

FUNCTION PBMAIN

    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app=%NULL THEN
        EXIT FUNCTION
    END IF





    '-Variable And tab
    ' Dimes
    DIM  i AS LONG, j AS LONG
    DIM font_ AS IGUIFont
    DIM cam AS CameraNode

    DIM mesh_(%NbBranche+1, %NBPivot+1) AS EntityNode
    DIM pivot(%NbBranche+1, %NBPivot+1) AS EntityNode





    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    font_ = GetFont()



    DIM cubemesh AS Mesh
    cubemesh = CreateCubeMesh(1.0)
    ScaleMesh(cubemesh, 8,8,32)
    '-----------------------------------------
    '-build general mesh
    FOR j = 0 TO %NbBranche
        'center Pivot
        pivot(j, 0) = CreatePivot(%NULL)
        ' fisrt bones on pivot 0
        mesh_(j, 0) =  CreateEntityNode(cubemesh, 0,0,0,pivot(j, 0))
        LoadTextureNode(mesh_(j, 0), "media/glass.bmp", 0, 0)
        TranslateNode( mesh_(j, 0), 0, 0, 25)

        'other bones
        FOR i = 0 TO %NBPivot - 1
            pivot(j, i + 1) = CreatePivot(mesh_(j, i))
            TranslateNode(pivot(j, i + 1), 0, 0, 25)
            mesh_(j, i + 1) = CreateEntityNode(cubemesh , 0,0,0,pivot(j, i + 1))
            LoadTextureNode(mesh_(j, i + 1), "media/glass.bmp", 0, 0)
            TranslateNode(mesh_(j, i + 1), 0, 0, 25)
        NEXT
    NEXT


    '----------------------------------------
    ' Create a camera
    cam = CreateCamera(%NULL)
    PositionNode(cam, 0,0,-400)

    WHILE Quit = 0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF



        FOR j = 0 TO %NbBranche
            RotateNode( pivot(j, 0), (45-(GetMouseY()/8)), 360.0/(%NbBranche+1) * j + (GetMouseX()/2), 0)
            FOR i = 1 TO %NBPivot
                RotateNode(pivot(j, i), 45-(GetMouseY()/8), 0, 0)
            NEXT
        NEXT




        ' ---------------
        '      Render
        ' ---------------
        BeginScene(0, 0, 0, 255, 1, 1)
        DrawScene()
        DrawText(font_, "mouve mouse",  10,10,0,0, &h0ff9999ff)
        EndScene()


    WEND
    ' end
    FreeEngine()
END FUNCTION
                                   

Peter Weis

#22
The views are unfortunately somewhat complicated because the Powerbasic can not >:(

DECLARE SUB DrawText CDECL LIB "N3XTD.DLL" ALIAS "_DrawText"(byval font as IGUIFont, byval text as asciz Ptr,  _
                    byval x as long, _
                    byval y as long, _
                   opt byval rx as long, _
                  opt byval ry as long,  _
                 opt byval col as long=&hff9999ff)   



Visual Basic and FreeBasic can

Peter Weis


' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  024   as  split test
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#INCLUDE "N3xtD.bi"

FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(1024,768, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF



    '-----------------------------------
    ' add in memory management system a zip file
    AddZipFileArchive( "media/map-20kdm2.pk3" )


    '-----------------------------------
    ' Load Quake3 scene Object
    DIM obj AS Mesh
    obj = LoadMesh("20kdm2.bsp", %HARDMAPPING.EHM_STATIC)


    ' Create a mesh with one of the 3D Object loaded
    DIM quake AS EntityNode
    quake = CreateEntityNode(obj, 0, 0, 0, %NULL)



    '-----------------------------------
    ' Create And position  cameras
    ' camera 1
    DIM cam1 AS CameraNode
    cam1 = CreateCamera(%NULL)
    PositionNode(cam1, 1850, 800, 1850)
    RotateNode(cam1, 30,200, 0)

    DIM cam2 AS CameraNode
    cam2 = CreateCamera(%NULL)
    PositionNode(cam2, 1300, 1800, 1300)
    TargetCamera(cam2, 1300,1000, 1300)
    ' camera 3
    DIM cam3 AS CameraNode
    cam3 = CreateCamera(%NULL)
    PositionNode(cam3, 100, 500, 150)
    TargetCamera(cam3, 180,500,170)
    ' camera 4
    DIM cam4 AS CameraNode
    cam4 = CreateCameraFPS(80.0,  0.1, 1.0, BYVAL %NULL, 0, %False, %False, %NULL)
    PositionNode(cam4, 726, 724, 330)
    TargetCamera(cam4, 826, 724, 830)



    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()


    DIM ResX AS LONG
    ResX = 1024
    DIM ResY AS LONG
    ResY = 768

    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit=0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF

        TurnNode(cam1, 0, 0.25, 0, 0)

        ' ---------------
        '      Render
        ' ---------------
        SetViewPort( 0,0,ResX,ResY)
        BeginScene(0,0,0, 255, 1, 1)

        ActiveCamera(cam1)
        SetViewPort( 0,0,ResX/2,ResY/2)
        DrawScene()

        ActiveCamera(cam2)
        SetViewPort( ResX/2,0,ResX,ResY/2)
        DrawScene()

        ActiveCamera(cam3)
        SetViewPort( 0,ResY/2,ResX/2,ResY)
        DrawScene()

        ActiveCamera(cam4)
        SetViewPort( ResX/2,ResY/2,ResX,ResY)
        DrawScene()

        DrawText(font_, "move camera4 with mouse(click left) and dir key",  10,10,0,0, &h0ff9999ff)
        EndScene()


    WEND
    ' end
    FreeEngine()
END FUNCTION
                     

Jeff Blakeney

I have been following this thread with interest.  When this engine was first mentioned I looked into it a little but I'm not sure it is the best but it would probably be fun to play with.  Unfortunately I don't have much time to play with it myself at present but hopefully I will before the end of the year.

Peter Weis


' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  025   as   SkyBox Test.
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#INCLUDE "N3xtD.bi"


FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF





    '-----------------------------------------
    ' set ambient light
    AmbientLight(&h0ffaaaaaa)


    '-----------------------------------------
    ' Create a cube And set position
    DIM cubemesh AS Mesh
    cubemesh = CreateCubeMesh(1.0)

    DIM cube AS EntityNode
    cube = CreateEntityNode(cubemesh, 0,  0, 0, %NULL)
    PositionNode(cube, 0,0,0)
    LoadTextureNode(cube, "media/glass.bmp", 0, 0)


    ' Create Skybox
    DIM sky AS EntityNode
    sky = CreateSkybox(LoadTexture("media/up.jpg"), LoadTexture("media/dn.jpg"), LoadTexture("media/lf.jpg"), LoadTexture("media/rt.jpg"),_
        LoadTexture("media/ft.jpg"), LoadTexture("media/bk.jpg"), %NULL)




    '-----------------------------------------
    ' Create first  camera
    DIM cam AS CameraNode
    cam = CreateCameraFPS(80.0,  0.1, 1.0, BYVAL %NULL, 0, %False, %False, %NULL)
    PositionNode(cam, 0,1,-10)


    '-----------------------------------
    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()



    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit = 0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF

        TurnNode(cube, 0,1,0, 0)



        ' ---------------
        '      Render
        ' ---------------
        BeginScene(128,128,128, 255, 1, 1)
        DrawScene()
        DrawText(font_, "SkyBox demo",  10,10,0,0, &h0ff00ffff)
        EndScene()

    WEND
    ' end
    FreeEngine()

END FUNCTION
                                     

Brice Manuel

Quote from: Jeff Blakeney on September 28, 2011, 06:55:17 PMWhen this engine was first mentioned I looked into it a little but I'm not sure it is the best but it would probably be fun to play with.

Best is highly subjective.  When it comes to free commercial-grade 3D engines, there are only two:  OGRE and Irrlicht.  Both are cross-platform and both support DirectX and OpenGL.  OGRE has been used for commercial games, even some that have been on retail shelves.  Irrlicht has been used for commercial games.  Irrlicht has the reputation of being easier to work with.

N3xtD is a 3D game engine that is based on Irrlicht which is simply a 3D engine.  N3xtD is a proven engine and has been used in commercial projects.  Some key features of N3xtD:

~  Supports most features of Irrlicht
~  Newton Physics built in
~  DirectX, OpenGL and Software rendering
~  Supports many common model formats and has an excellent art pipeline
~  Shader support (GLSL/HLSL)

The current version of N3xtD is free.  It has been used for commercial projects (game & app) and is capable of being used for apps and games with no problems.  Future versions of N3xtD will cost $$.  I can't speak to how well N3xtD works with PowerBASIC, you would have to ask a PowerBASIC user, but Peter seems to have no problems working with N3xtD and PowerBASIC.   :)

Peter Weis

#27
Hello Manuel,

Who you know how to pass variables must be in the PowerBASIC no problem!

PowerBASIC is my favorite programming language!

The transfer of optional parameters and values ​​is somewhat problematic! It is simply not optional parameter with a value in the declaration to show before!

example:

Declare TestFunction cdecl alias "_testfunction" (opt byval x as dword = 10)

Pointers to structures are manifested only returned as a DWORD not simply as a pointer named

It's just a shame Bob Zale has slept here something! There is much new in PowerBASIC 10

regards Peter





Peter Weis

#28

' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  026   as   SkyDome Test.
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------

' Includes libraries
#INCLUDE "N3xtD.bi"

FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS LONG


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF



    '-----------------------------------------
    ' set ambient light
    AmbientLight(&h0ffaaaaaa)


    '-----------------------------------------
    ' Create a cube And set position
    DIM cubemesh AS Mesh
    cubemesh = CreateCubeMesh(1.0)

    DIM cube AS EntityNode
    cube = CreateEntityNode(cubemesh, 0,  0, 0, %NULL)
    PositionNode(cube, 0,0,0)
    LoadTextureNode(cube, "media/glass.bmp", 0, 0)


    'Create skydome
    DIM sky AS EntityNode
    sky = CreateSkydome(LoadTexture("media/env_sky.jpg"), 16, 8, 0.95, 1.3, 1000.0, %NULL)



    '-----------------------------------------
    ' Create first  camera
    DIM cam AS CameraNode
    cam = CreateCameraFPS(80.0,  0.1, 1.0, BYVAL %NULL, 0, %False, %False, %NULL )
    PositionNode(cam, 0,1,-10)


    '-----------------------------------
    ' simple text inside the scene area
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()



    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit=0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF

        TurnNode(cube, 0,1,0, 0)


        ' ---------------
        '      Render
        ' ---------------
        BeginScene(128,128,128, 255, 1, 1)
        DrawScene()
        DrawText(font_, "SkyDome demo",  10,10,0,0, &h0ff00ffff)
        EndScene()


    WEND
    ' end
    FreeEngine()

END FUNCTION

                               

Peter Weis


' ------------------------------------------------------------
'   n3xt-D exemples
'
'   Sample  027   as   Poursuite Test.
'   Historique   as
'     29/03/09  19 as 16    TMyke
'
' ------------------------------------------------------------
' Includes libraries
#INCLUDE "N3xtD.bi"

FUNCTION PBMAIN
    ' Dimes
    DIM app AS DWORD
    DIM Quit AS INTEGER


    '----------------------------------------------------------
    ' open n3xt-D screen
    app = CreateGraphics3D(800,600, 32, 0, %TRUE, %DEVICE_TYPES.EDT_DIRECT3D9, %TRUE)
    IF app = %NULL THEN
        EXIT FUNCTION
    END IF


    '-----------------------------------------
    ' set ambient light
    ' _AmbientLight( &hffaaaaaa)
    '----------------------------------------
    ' Create light And set position
    DIM light AS LightNode
    light = CreateLight(&h0ffffffff, 180, %ELT_POINT , %NULL)
    PositionNode(light, 0,30,10)



    ' turn off MipMap
    TextureCreation( %ETCF_CREATE_MIP_MAPS, %False )

    '----------------------------------------
    ' Load 3D objects
    DIM obj1 AS Mesh
    obj1 = LoadMesh("media/plane.3ds", %HARDMAPPING.EHM_STATIC)
    DIM obj2 AS Mesh
    obj2 = LoadMesh("media/earth.x", %HARDMAPPING.EHM_STATIC)


    '-----------------------------------------
    ' Create plane
    DIM plane AS EntityNode
    plane  =  CreateEntityNode(obj1, 0,  0,  0, %NULL)

    '-----------------------------------------
    ' Create sphere
    DIM sphere AS EntityNode
    sphere =  CreateEntityNode(obj2, 0,  0,  0, %NULL)
    PositionNode(sphere, 0,0.5,5)
    ScaleNode(sphere, 1.5,1.5,1.5)


    '-----------------------------------------
    ' Create arrow mesh
    DIM obj3 AS Mesh
    obj3 = CreateArrowMesh(4, 8, 1.0, 0.6, 0.05, 0.3, &h0ffffffff, &h0ffffffff)
    ScaleMesh(obj3, 3,4,3)
    RotateMesh(obj3, 90,0,0)
    ' And the node associed
    DIM cc AS EntityNode
    cc = CreateEntityNode(obj3, 0,  0,  0, %NULL)
    PositionNode(cc, 0,5,0)


    PointNode(cc, sphere, 0)



    '-----------------------------------------
    ' Create first  camera
    DIM cam AS CameraNode
    cam = CreateCamera(%NULL)
    PositionNode(cam, 0,10,-15)
    TurnNode(cam, 15,0,0, 0)

    '-----------------------------------
    ' Load font png
    LoadFont("media/courriernew.png", %FONT_TYPE.EGDF_DEFAULT)
    DIM font_ AS IGUIFont
    font_ = GetFont()




    ' ---------------------------------------
    '           Main loop
    ' ---------------------------------------
    WHILE Quit=0


        ' If Escape Key, Exit
        IF GetKeyDown(%KEY_CODE.KEY_ESCAPE) THEN
            Quit=1
        END IF

        ' control earth
        IF GetKeyDown(%KEY_CODE.KEY_ARROW_UP) THEN
            TranslateNode(sphere, 0,0,0.5)
            PointNode(cc, sphere, 0)
        END IF
        IF GetKeyDown(%KEY_CODE.KEY_ARROW_DOWN) THEN
            TranslateNode(sphere, 0,0,-0.5)
            PointNode(cc, sphere, 0)
        END IF
        IF GetKeyDown(%KEY_CODE.KEY_ARROW_RIGHT) THEN
            TranslateNode(sphere, 0.5,0,0)
            PointNode(cc, sphere, 0)
        END IF
        IF GetKeyDown(%KEY_CODE.KEY_ARROW_LEFT) THEN
            TranslateNode(sphere, -0.5,0,0)
            PointNode(cc, sphere, 0)
        END IF
        IF GetKeyDown(%KEY_CODE.KEY_KEY_R) THEN
            TranslateNode(sphere, 0,0.5,0)
            PointNode(cc, sphere, 0)
        END IF
        IF GetKeyDown(%KEY_CODE.KEY_KEY_F) THEN
            TranslateNode(sphere, 0,-0.5,0)
            PointNode(cc, sphere, 0)
        END IF


        IF GetMouseEvent(%MOUSE_EVENT.MOUSE_BUTTON_LEFT) THEN
            DIM angley AS SINGLE
            angley =  GetDeltaMouseX(0) / 4.0
            DIM anglex AS SINGLE
            angley =  GetDeltaMouseY(0) / 4.0
            TurnNode(cam, anglex, angley, 0, 0)
        END IF



        ' ---------------
        '      Render
        ' ---------------
        BeginScene(0, 0, 0, 255, 1, 1)
        DrawScene()
        DrawText(font_, "DirKey and R/F for move earth",  10,10,0,0, &h0ff00ffff)
        EndScene()

    WEND

    ' end
    FreeEngine()
END FUNCTION