Jump to content

Skybox


Icare
 Share

Recommended Posts

Hi

 

I can't seem to render the sky with the framework, I do not know what I wrong. After I tried to do it with the editor, and when I load my scene, the sky does not appear either but I see it on the editor

 

 

 

My code source :

SuperStrict

Framework leadwerks.engine
Import "Framework\framework.bmx"

AppTitle:String = "skybox"


RegisterAbstractPath(CurrentDir())

'Create a Graphics window
Graphics(1024, 768)

RegisterAbstractPath(CurrentDir())
'Create a new Framework object.
Global fw:TFramework = TFramework.Create()
If Not fw RuntimeError "Failed to initialize engine."

Global Camera:TCamera = fw.main.camera

SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"))

Global Light:tLight=CreateDirectionalLight()

Local camrotation:TVec3 = Vec3(0)
Local mx:Float 
Local my:Float

Local move:Float
Local strafe:Float


Repeat

mx=Curve(MouseX()-GraphicsWidth()/2,mx,6) 
my=Curve(MouseY()-GraphicsHeight()/2,my,6)


MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2

'Add the mouse movement to the camera rotation 
camrotation.x=camrotation.x+my/10
camrotation.y=camrotation.y-mx/10

move=Curve((KeyDown(KEY_Z) Or KeyDown(KEY_UP)) - (KeyDown(KEY_S) Or KeyDown(KEY_DOWN)),move,20) 
strafe=Curve((KeyDown(KEY_D) Or KeyDown(KEY_RIGHT)) - (KeyDown(KEY_Q) Or KeyDown(KEY_LEFT)),strafe,20)

MoveEntity Camera,Vec3(strafe/5,0,move/5)
RotateEntity Camera,camrotation

       If KeyHit(KEY_ESCAPE) Exit
       If AppTerminate() Exit

       UpdateAppTime()
       UpdateWorld(AppSpeed())


    fw.Update()
    fw.Render()


       Flip(0)
Forever

fw.renderer.gbuffer = Null

End

Link to comment
Share on other sites

Also, to get your program above to work, add this before the main loop:

SetBackgroundColor(Vec4(1, 1, 1, 1))

 

This was added to allow people greater control over day/night cycles in 2.32... so the default is setting the background color to black. Personally I think the default should be what I posted, but... :)

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Guest Red Ocktober

it took me over an hour trying to figure out why my skybox wasn't showing because of this change...

 

even if the change was deemed necessary to allow more flexibility by the coder, i'd agree that the default background color should leave the skybox visible, if there is one...

 

--Mike

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...