Solar system, particle Sun and rotational skybox

Everything related to 3D programming
User avatar
DK_PETER
Addict
Addict
Posts: 904
Joined: Sat Feb 19, 2011 10:06 am
Location: Denmark
Contact:

Solar system, particle Sun and rotational skybox

Post by DK_PETER »

EDIT: Time to clean up. Need space for something else:(07-18-2014)

Add your own media to the code:

SOLAR:

Code: Select all

Declare.i MakeTmpPicture()

Procedure.i MakeTmpPicture()
  Protected im.i
  im = CreateImage(#PB_Any,1024, 768,32, #Black)
  StartDrawing(ImageOutput(im))
  For X = 0 To 2000
    Plot(Random(1023,1),Random(767,1), RGB(Random(255,100), Random(255,100), Random(255,100)))
  Next x
  StopDrawing()
  ProcedureReturn im
EndProcedure

_Scr::Init(1, 1, 1, 1, 1,0)  ;Initialize Everything
_Scr::SetupTitle("Set your resolution")
_Scr::SoftwareTitle("Sol system test version 0.01")
_Scr::AddSettingsImage(MakeTmpPicture())
ret = _Scr::RunSetting()

If ret = #False
  End
EndIf


DeclareModule _Solarsystem
  
  Structure Vector3D
    x.f
    y.f
    z.f
  EndStructure

  Structure _mesh
    id.i
    mat.i
    mes.i
    tex.i
    x.f
    y.f
    z.f
  EndStructure
  
  Structure _Globe
    gl._mesh
    cl._mesh
    node.i
  EndStructure
  
  Global Dim pl._Globe(10)
  
  Declare RunTest()
  
EndDeclareModule

Module _Solarsystem
  
  Procedure Init()
    Add3DArchive("\", #PB_3DArchive_FileSystem)
    Parse3DScripts()
  EndProcedure
  
  Procedure.i CreateSystem()
    With pl(0)\gl
      \mes = CreateSphere(#PB_Any, 100, 80, 80)
      \tex = LoadTexture(#PB_Any, "sun.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, 0.3,0, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 0, 0, 0)
    EndWith
    With pl(1)\gl
      \mes = CreateSphere(#PB_Any, 0.3, 20, 20)
      \tex = LoadTexture(#PB_Any, "mercury.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, 0.3,0, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 102, 0, 102)
      pl(1)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(1)\node, EntityID(\id))
    EndWith
    With pl(2)\gl
      \mes = CreateSphere(#PB_Any, 6.3, 20, 20)
      \tex = LoadTexture(#PB_Any, "venus.png")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.1,0, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 114, 0, 114)
      pl(2)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(2)\node, EntityID(\id))
    EndWith
      
    With pl(3)\gl
      \mes = CreateSphere(#PB_Any, 1, 20, 20)
      \tex = LoadTexture(#PB_Any, "earth.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, 0.1, 0, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 148, 0, 148)
      pl(3)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(3)\node, EntityID(\id))
    EndWith
    With pl(3)\cl
      \mes = CreateSphere(#PB_Any, 1.2, 20, 20)
      \tex = LoadTexture(#PB_Any, "cloud.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 148, 0, 148)
      AttachNodeObject(pl(3)\node, EntityID(\id))
    EndWith
    
    With pl(4)\gl
      \mes = CreateSphere(#PB_Any, 0.9, 20, 20)
      \tex = LoadTexture(#PB_Any, "mars.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 158, 0, 158)
      pl(4)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(4)\node, EntityID(\id))
    EndWith
    
    With pl(5)\gl
      \mes = CreateSphere(#PB_Any, 16, 20, 20)
      \tex = LoadTexture(#PB_Any, "jupiter.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 258, 0, 258)
      pl(5)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(5)\node, EntityID(\id))
    EndWith
    With pl(5)\cl
      \mes = CreateSphere(#PB_Any, 5, 20, 20)
      \tex = CreateTexture(#PB_Any, 512, 512)
      StartDrawing(TextureOutput(\tex))
      Box(0, 0, 512,512, #Black)
      For x = 0 To 600
        col = Random(255,100)
        Circle(Random(500, 12), Random(500,12), Random(2,1), RGB(col,col,col))
      Next x
      StopDrawing()
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      MaterialBlendingMode(\mat, #PB_Material_Add)
      DisableMaterialLighting(\mat, #True)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 258, 0, 258)
      ScrollMaterial(\mat, 0.1,0, #PB_Relative)
      ScaleEntity(\id, 10,0.1,12)
      AttachNodeObject(pl(5)\node, EntityID(\id))
    EndWith
    
    With pl(6)\gl
      \mes = CreateSphere(#PB_Any, 15, 20, 20)
      \tex = LoadTexture(#PB_Any, "saturn.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 308, 0, -308)
      pl(6)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(6)\node, EntityID(\id))
    EndWith
    
    With pl(6)\cl
      \mes = CreateSphere(#PB_Any, 5, 20, 20)
      \tex = CreateTexture(#PB_Any, 512, 512)
      StartDrawing(TextureOutput(\tex))
      Box(0, 0, 512,512, #Black)
      For x = 0 To 900
        col = Random(255,100)
        Circle(Random(500, 12), Random(500,12), Random(2,1), RGB(col,col,col))
      Next x
      StopDrawing()
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      MaterialBlendingMode(\mat, #PB_Material_Add)
      DisableMaterialLighting(\mat, #True)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 308, 0, -308)
      ScrollMaterial(\mat, 0.1,0, #PB_Relative)
      ScaleEntity(\id, 10,0.5,10)
      AttachNodeObject(pl(6)\node, EntityID(\id))
    EndWith
    
    With pl(7)\gl
      \mes = CreateSphere(#PB_Any, 15, 20, 20)
      \tex = LoadTexture(#PB_Any, "uranus.jpg")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 358, 0, -358)
      pl(7)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(7)\node, EntityID(\id))
    EndWith
    
    With pl(7)\cl
      \mes = CreateSphere(#PB_Any, 5, 20, 20)
      \tex = CreateTexture(#PB_Any, 512, 512)
      StartDrawing(TextureOutput(\tex))
      Box(0, 0, 512,512, #Black)
      For x = 0 To 700
        col = Random(255,100)
        Circle(Random(500, 12), Random(500,12), Random(2,1), RGB(col,col,col))
      Next x
      StopDrawing()
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      MaterialBlendingMode(\mat, #PB_Material_Add)
      DisableMaterialLighting(\mat, #True)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 358, 0, -358)
      ScrollMaterial(\mat, 0.1,0, #PB_Relative)
      ScaleEntity(\id, 10,0.3,10)
      RotateEntity(\id, 90,0, 0)
      AttachNodeObject(pl(7)\node, EntityID(\id))
    EndWith
    
    With pl(8)\gl
      \mes = CreateSphere(#PB_Any, 15, 20, 20)
      \tex = LoadTexture(#PB_Any, "neptune.png")
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      DisableMaterialLighting(\mat, #True)
      ScrollMaterial(\mat, -0.01, 0.02, #PB_Relative)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 398, 0, -398)
      pl(8)\node = CreateNode(#PB_Any, 0, 0, 0)
      AttachNodeObject(pl(8)\node, EntityID(\id))
    EndWith
    
    With pl(8)\cl
      \mes = CreateSphere(#PB_Any, 5, 20, 20)
      \tex = CreateTexture(#PB_Any, 512, 512)
      StartDrawing(TextureOutput(\tex))
      Box(0, 0, 512,512, #Black)
      For x = 0 To 200
        col = Random(255,100)
        Circle(Random(500, 12), Random(500,12), Random(2,1), RGB(col,col,col))
      Next x
      StopDrawing()
      \mat = CreateMaterial(#PB_Any, TextureID(\tex))
      MaterialBlendingMode(\mat, #PB_Material_Add)
      DisableMaterialLighting(\mat, #True)
      \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat), 398, 0, -398)
      ScrollMaterial(\mat, 0.1,0, #PB_Relative)
      ScaleEntity(\id, 10,0.1,10)
      AttachNodeObject(pl(8)\node, EntityID(\id))
    EndWith

    
  EndProcedure
  
  Procedure RunTest()
    Init()
    Cam.i = CreateCamera(#PB_Any, 0, 0, 100, 100)
    MoveCamera(Cam, 0, 700, 500)
    CameraLookAt(Cam, 0, 0, 0)
    CreateSystem()
    
    mercStart  = ElapsedMilliseconds()
    venusStart = ElapsedMilliseconds()
    earthStart = ElapsedMilliseconds()
    marsStart  = ElapsedMilliseconds()
    jupStart   = ElapsedMilliseconds()
    satStart   = ElapsedMilliseconds()
    uraStart   = ElapsedMilliseconds()
    nepStart   = ElapsedMilliseconds()
    
    Repeat
      
      If _Scr::IsFullScreen() = #False
        Repeat
          ev = WindowEvent()
        Until ev = 0
      EndIf  
        
        ExamineKeyboard()
        If ElapsedMilliseconds() - mercStart > 10
          RotateNode(pl(1)\node, 0, 2, 0, #PB_Relative)
          mercStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - venusStart > 10
          RotateNode(pl(2)\node, 0, 0.5, 0, #PB_Relative)
          venusStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - earthStart > 10
          RotateNode(pl(3)\node, 0, 0.3, 0, #PB_Relative)   ; yes..Moon isn't there...
          earthStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - marsStart > 10
          RotateNode(pl(4)\node, 0, 0.6, 0, #PB_Relative)
          marsStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - jupStart > 10
          RotateNode(pl(5)\node, 0, 0.3, 0, #PB_Relative)
          jupStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - satStart > 10
          RotateNode(pl(6)\node, 0, 0.3, 0, #PB_Relative)
          satStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - uraStart > 10
          RotateNode(pl(7)\node, 0, 0.6, 0, #PB_Relative)
          satStart = ElapsedMilliseconds()
        EndIf
        If ElapsedMilliseconds() - nepStart > 10
          RotateNode(pl(8)\node, 0, 0.4, 0, #PB_Relative)
          satStart = ElapsedMilliseconds()
        EndIf

        
        RenderWorld()
        
        
        FlipBuffers()
          
      Until KeyboardPushed(#PB_Key_Escape)
      
    
  EndProcedure
EndModule

_Solarsystem::RunTest()
DESERT:

Code: Select all

Add3DArchive("\",#PB_3DArchive_FileSystem)

Parse3DScripts()

Structure _Mesh
  id.i
  tex.i
  mat.i
  mes.i
  x.f
  y.f
  z.f
EndStructure

Structure _Par
  id.i
  mat.i
  tex.i
  x.f
  y.f
  z.f
EndStructure

Structure _SkyData
  id.i[6]  
  ms.i[6]
  ma.i[6]
  tx.i[6]
  node.i
EndStructure


Global cam.i
Global SkyB._SkyData
Global ter._Mesh
Global NewSun._Mesh, Light.i
Global sand._Par, parSun._Par
Global Geo.i
Global NewList ob._Mesh()

cam = CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(Cam, 0, 0, 0, #PB_Absolute)
CameraLookAt(Cam, 0, 0, 0)

Procedure.i MakeSkyBox(Filename.s = "", PBFORMAT.i = #True) ; 
  ;Two Options available: PBFORMAT = #True  - FR,BK,UP,DN,LF,RT
  ;                                = #False - right1, left2, top3, bottom4, front5, back6
  
  Protected file.s, ext.s, w.i, h.i
  
  If IsNode(SkyB\node) > 0 Or Filename = ""
    FreeNode(SkyB\node)
    For x = 0 To 5
      FreeMaterial(SkyB\ma[x])
      FreeTexture(SkyB\tx[x])
      FreeEntity(SkyB\id[x])
      FreeMesh(SkyB\ms[x])
    Next x
    ; So...Memory cleaned for new skybox
    If Filename = "" 
      ProcedureReturn #False
    EndIf
  EndIf
  
  SkyB\node = CreateNode(#PB_Any, CameraX(cam), CameraY(cam), CameraZ(cam)) ;Use for skybox planes
  
  file = GetFilePart(Filename,#PB_FileSystem_NoExtension)
  ext  = GetExtensionPart(Filename)
  
  With SkyB
    If PBFORMAT = #True 
      \tx[0] = LoadTexture(#PB_Any, file + "_FR." + ext)
      \tx[1] = LoadTexture(#PB_Any, file + "_BK." + ext)
      \tx[2] = LoadTexture(#PB_Any, file + "_UP." + ext)
      \tx[3] = LoadTexture(#PB_Any, file + "_DN." + ext)
      \tx[4] = LoadTexture(#PB_Any, file + "_LF." + ext)
      \tx[5] = LoadTexture(#PB_Any, file + "_RT." + ext)
    Else
      \tx[0] = LoadTexture(#PB_Any, file + "_front5." + ext)
      \tx[1] = LoadTexture(#PB_Any, file + "_back6." + ext)
      \tx[2] = LoadTexture(#PB_Any, file + "_top3." + ext)
      \tx[3] = LoadTexture(#PB_Any, file + "_bottom4." + ext)
      \tx[4] = LoadTexture(#PB_Any, file + "_left2." + ext)
      \tx[5] = LoadTexture(#PB_Any, file + "_right1." + ext)
      
    EndIf
    w = TextureWidth(\tx[0]) / 2
    h = TextureHeight(\tx[0]) / 2
    For x = 0 To 5
      \ms[x] = CreatePlane(#PB_Any, w, h, 1, 1, 1, 1)
      \ma[x] = CreateMaterial(#PB_Any, TextureID(\tx[x]))
      DisableMaterialLighting(\ma[x], #True)
      \id[x] = CreateEntity(#PB_Any, MeshID(\ms[x]), MaterialID(\ma[x]), 0, 0, 0)
      HideEntity(\id[x], 1)
    Next x

    HideEntity(\id[0], 0)
    RotateEntity(\id[0], -90, 0, 0, #PB_Absolute)           
    MoveEntity(\id[0], CameraX(cam), CameraY(cam), CameraZ(cam) + w/2, #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[0]))
    
    HideEntity(\id[1], 0)
    RotateEntity(\id[1], 90, 180, 0, #PB_Absolute)          
    MoveEntity(\id[1], CameraX(cam), CameraY(cam), CameraZ(cam)-w/2, #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[1]))
    
    
    HideEntity(\id[2], 0)
    RotateEntity(\id[2], 180, 0, 0, #PB_Absolute)           
    MoveEntity(\id[2], CameraX(cam), CameraY(cam) + w/2, CameraZ(cam), #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[2]))
    
    
    HideEntity(\id[3], 0)
    RotateEntity(\id[3], 0, 0, 0, #PB_Absolute)              
    MoveEntity(\id[3], CameraX(cam), CameraY(cam)-w/2, CameraZ(cam), #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[3]))
    
    
    HideEntity(\id[4], 0)
    RotateEntity(\id[4], -90, 0, 90, #PB_Absolute)          
    MoveEntity(\id[4], CameraX(cam) + w/2, CameraY(cam) , CameraZ(cam), #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[4]))
    
    HideEntity(\id[5], 0)
    RotateEntity(\id[5], -90, 0, -90, #PB_Absolute)          
    MoveEntity(\id[5], CameraX(cam)-w/2, CameraY(cam) , CameraZ(cam), #PB_Absolute)    ; 
    AttachNodeObject(SkyB\node, EntityID(\id[5]))
    
    
  EndWith
EndProcedure



Procedure.i MakeTmpPicture()
  Protected im.i, fo.i
  fo = LoadFont(#PB_Any, "Arial", 48)
  im = CreateImage(#PB_Any, 1024, 1024, 32)
  StartDrawing(ImageOutput(im))
  FrontColor($FFFFFF)
  For x = 0 To 2000
    Plot(Random(1022, 1), Random(700, 1))
  Next x
  DrawingMode(#PB_2DDrawing_AllChannels)
  DrawingMode(#PB_2DDrawing_Gradient|#PB_2DDrawing_AlphaBlend)
  FrontColor($FAAAAAAA)
  BackColor($4F888888)
  CircularGradient(100,100, 50)
  Circle(100,100,50)
  DrawingMode(#PB_2DDrawing_AllChannels)
  
  Box(0,800, 1024, 224, RGBA(222, 167, 40, 255))
  For x = 0 To 10
    newrad = Random(80, 10)
    Circle(Random(1024-newrad, 1+newrad), 800 + (newrad/2), newrad, RGBA(222, 167, 40, Random(255,100)))
  Next x
  
  DrawingMode(#PB_2DDrawing_Transparent)
  DrawingFont(FontID(fo))
  DrawText( 400, 400, "Desert Sky", $FF28A7DE)
  StopDrawing()
  
  ProcedureReturn im
EndProcedure

Procedure .i CreateNewSun()
  parSun\id = GetScriptParticleEmitter(#PB_Any, "SunTemp")
  MoveParticleEmitter(parSun\id, -40, 60, 40)
  AttachNodeObject(SkyB\node, ParticleEmitterID(parSun\id))
  
  light = CreateLight(#PB_Any ,RGB(190, 190, 190), -40, 60, 40,#PB_Light_Directional)
  SetLightColor(light, #PB_Light_SpecularColor, RGB(255*0.4, 255*0.4,255*0.4)) 
  LightLookAt(Light, CameraX(cam), CameraY(cam), CameraZ(cam))
  AttachNodeObject(SkyB\node, LightID(Light))
  
EndProcedure

Procedure CreateAncientCity()
  Protected template1._Mesh
  Geo = CreateStaticGeometry(#PB_Any, 1000, 100, 1000, #True)
  ;Build template
  With template1
    \tex = LoadTexture(#PB_Any, "errode.bmp")
    \mat = CreateMaterial(#PB_Any, TextureID(\tex))
    \mes = CreateCube(#PB_Any, 1)
    \id  = CreateEntity(#PB_Any, MeshID(\mes), MaterialID(\mat))
    
    AddElement(ob())
    ob()\id = CopyEntity(\id, #PB_Any)
    
    AddStaticGeometryEntity(Geo, EntityID(ob()\id), 5, -1, -5, 2, 1, 4)
    AddElement(ob())
    ob()\id = CopyEntity(\id, #PB_Any)
    AddStaticGeometryEntity(Geo, EntityID(ob()\id), 4.5, -0.6, -5, 0.5, 0.5, 3.5)
    AddElement(ob())
    ob()\id = CopyEntity(\id, #PB_Any)
    AddStaticGeometryEntity(Geo, EntityID(ob()\id), 5.5, -0.6, -5, 0.5, 0.5, 3.5)
    AddElement(ob())
    ob()\id = CopyEntity(\id, #PB_Any)
    AddStaticGeometryEntity(Geo, EntityID(ob()\id), 5, 0.1, -5, 1.3, 1, 2.7)
    AddElement(ob())
    
    For x = 0 To 10 
      AddElement(ob())
      ob()\id = CopyEntity(\id, #PB_Any)
      AddStaticGeometryEntity(Geo, EntityID(ob()\id), -10, x * 0.5, -20, 20-x , 0.5, 20-x)
    Next x
    
  EndWith
  ter\mes = CreatePlane(#PB_Any, 1000,1000,1,1,1,1)
  ter\tex = LoadTexture(#PB_Any, "sandy.jpg")
  ter\mat = CreateMaterial(#PB_Any, TextureID(ter\tex))
  ter\id  = CreateEntity(#PB_Any, MeshID(ter\mes), MaterialID(ter\mat), 0, -20, 0)
  AddStaticGeometryEntity(Geo, EntityID(ter\id), 0, -10, 0, 6 , 1, 6)
  
  BuildStaticGeometry(Geo)
EndProcedure

Procedure RunPrg()
  
  MakeSkyBox("star.jpg")
  CreateNewSun()
  CreateAncientCity()
  
  SkyStart = ElapsedMilliseconds()
  
  Repeat
    
    If _Scr::IsFullScreen() = #False
      Repeat
        ev = WindowEvent()
      Until ev = 0
    EndIf
    
    If ElapsedMilliseconds()-SkyStart > 25 And IsNode(SkyB\node) > 0 
      RotateNode(SkyB\node, -0.02, 0, 0, #PB_Relative)  ; Skybox
      LightLookAt(Light, CameraX(cam), CameraY(cam), CameraZ(cam))
      SkyStart = ElapsedMilliseconds()
    EndIf
    
    ExamineKeyboard()
    
    MouseX.f = -MouseDeltaX() * 0.05
    MouseY.f = -MouseDeltaY() * 0.05

    ExamineMouse()
    
    RotateCamera(cam,  MouseY, MouseX, 0, #PB_Relative)     

    RenderWorld()
    
    FlipBuffers()
    
  Until KeyboardPushed(#PB_Key_Escape)
  
EndProcedure

RunPrg()
Last edited by DK_PETER on Fri Jul 18, 2014 7:49 pm, edited 2 times in total.
Current configurations:
Ubuntu 20.04/64 bit - Window 10 64 bit
Intel 6800K, GeForce Gtx 1060, 32 gb ram.
Amd Ryzen 9 5950X, GeForce 3070, 128 gb ram.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Solar system, particle Sun and rotational skybox

Post by applePi »

thanks Peter , it is very interesting, the solar and the desert programs have art spirit inside it in addition to the coding strategies. and also suitable for educational purposes. thanks for posting it.
Post Reply