Code: Select all
Enumeration
#MyMatl
#Win
EndEnumeration
InitEngine3D()
InitSprite()
InitKeyboard()
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/Sources\Data", #PB_3DArchive_FileSystem)
Add3DArchive("/", #PB_3DArchive_FileSystem)
OpenWindow(#Win,0,0,640,480,"..",#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Win),0,0,640,400,1,0,0)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0,0,200,5000,#PB_Absolute)
CameraLookAt(0, 0,0, 0)
CameraBackColor(0,RGB(77,160,100))
CreateLight(1,RGB(255,255,255),0,0,100)
LightDirection(1, 0, 0, 0)
CreateMaterial(#MyMatl, LoadTexture(0, "MRAMOR6X6.jpg"))
MaterialCullingMode(#MyMatl, #PB_Material_NoCulling)
;MaterialShadingMode(#MyMatl, #PB_Material_Wireframe)
MaterialShadingMode(#MyMatl, #PB_Material_Solid )
;CreateMesh(#MyMesh,#PB_Mesh_TriangleList, #PB_Mesh_Static)
CreateMesh(11, #PB_Mesh_TriangleList, #PB_Mesh_Dynamic)
MeshVertexPosition(0, 0, 0)
MeshVertexTextureCoordinate(0, 1)
MeshVertexPosition(0, 5000, 0)
MeshVertexTextureCoordinate(0, 0)
MeshVertexPosition(5000, 5000, 0)
MeshVertexTextureCoordinate(1, 0)
MeshVertexPosition(5000, 0, 0)
MeshVertexTextureCoordinate(1, 1)
MeshFace(0, 1, 2)
MeshFace(0, 3, 2)
NormalizeMesh(11)
;reading how to build faces
FinishMesh(#True)
CreateEntity(11, MeshID(11), MaterialID(#MyMatl), 0, 0, 0)
ScaleEntity(11, 0.4,0.4,0.4)
MoveEntity(11, 0, -1000,0)
CreateNode(11)
AttachNodeObject(11, EntityID(11))
ScaleNode(11, 1, 1, 1)
Repeat
Event = WindowEvent()
ExamineKeyboard()
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Event = #PB_Event_CloseWindow