My name is João i'm from Portugal and i'm learning how to use irrlicht for 5 days. I can code for 6 years but i'm nly getting realy into 3D right now.I learned a lot with this foruns since the wiki is down..
Now i have some questions.. (sorry if they are too many)
What is the best way to draw an all plane terrain (no deformation) and be able to know the 3D cordenate where the user clicked?
What is the best way to apply a texture that look good on an fps camera? (do you know any place where can get free textures and skyboxes?)
What is the best way to draw a fairly realistic skybox?
Now i'll show u what i have. It is in vb.net i hope you can understand. Feel free to help me in any other language.. The most i learned was looking at c++.
Code: Select all
Sub draw_terrain()
terrain.SetMaterialType(MaterialType.SOLID)
terrain.SetMaterialFlag(MaterialFlag.LIGHTING, False)
terrain.SetMaterialTexture(0, device.VideoDriver.GetTexture(path1 & "terrain-texture.jpg"))
terrain.SetMaterialTexture(1, device.VideoDriver.GetTexture(path1 & "detailmap3.jpg"))
terrain.SetMaterialType(MaterialType.DETAIL_MAP)
End Sub
Code: Select all
Public Sub set_camera(ByVal tipo As Integer)
CameraNode = device.SceneManager.AddCameraSceneNodeFPS(Nothing, 120, 90, 0)
CameraNode.Position = New Vector3D(0, 26, 0)
CameraNode.FarValue = 12000
CameraNode.InputReceiverEnabled = False
End Sub
Public Sub walk(ByVal speed As Integer, ByVal direction As Integer)
Dim vec As Vector3D = CameraNode.Target - CameraNode.Position
If direction = 1 Then
vec.Y = 0
Else
vec.X = 1
vec.Z = 0
End If
vec.Normalize()
CameraNode.Position += vec * speed
CameraNode.UpdateAbsolutePosition()
CameraNode.Render()
End Sub
Public Sub Rotate(ByVal speed As Integer)
Dim mat As Matrix4
mat.SetRotationDegrees(CameraNode.Rotation - New Vector3D(0, speed, 0))
Dim camUpVector As Vector3D = New Vector3D(0, 1, 0)
mat.TransformVect(camUpVector)
Dim targetvector As Vector3D = New Vector3D(0, 0, 1)
mat.TransformVect(targetvector)
Dim camTarget As Vector3D = CameraNode.Position + targetvector
Dim offset As Vector3D = New Vector3D(0, 0, 0)
CameraNode.Position += offset
CameraNode.UpVector = camUpVector
CameraNode.Target = camTarget + offset
CameraNode.UpdateAbsolutePosition()
End Sub
Code: Select all
Sub draw_skybox()
Dim driver As Video.IVideoDriver
driver = device.VideoDriver
device.VideoDriver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, False)
device.SceneManager.AddSkyBoxSceneNode(driver.GetTexture(path1 & "irrlicht2_up.jpg"), driver.GetTexture(path1 & "irrlicht2_dn.jpg"), driver.GetTexture(path1 & "irrlicht2_lf.jpg"), driver.GetTexture(path1 & "irrlicht2_rt.jpg"), driver.GetTexture(path1 & "irrlicht2_ft.jpg"), driver.GetTexture(path1 & "irrlicht2_bk.jpg"), Nothing, 0)
device.VideoDriver.SetTextureCreationFlag(TextureCreationFlag.CREATE_MIP_MAPS, False)
End Sub
Thank very much in advance.