refering to Comtois example
http://www.purebasic.fr/english/viewtop ... 34#p418511
seems to me the only way to texture a sphere room inside different than outside is to use two spheres with slight different radius centered to the same point and textured with different textures and then i use
MaterialCullingMode(tex1, #PB_Material_NoCulling )
MaterialCullingMode(tex2, #PB_Material_NoCulling )
Edit: the second line not necessary for the outside sphere unless we want to make a tour between the two walls
Code: Select all
;
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY, SpriteX, SpriteY
Global Dim MeshDataVertex.PB_MeshVertex(0)
Global Dim MeshDataIndex.PB_MeshFace(0)
If InitEngine3D()
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Scripts", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Packs/Desert.zip", #PB_3DArchive_Zip)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
;- Ground
;
CreateMaterial(0, LoadTexture(0, "Dirt.jpg"))
CreatePlane(0, 1500, 1500, 40, 40, 15, 15)
CreateEntity(0,MeshID(0),MaterialID(0))
EntityRenderMode(0, 0)
CreateCube(1, 50)
CreateEntity(1, MeshID(1), GetScriptMaterial(1, "Color/Blue"), 0, 50, 0)
;Sky
CreateMaterial(2, LoadTexture(2, "DosCarte.png"))
CreateMaterial(3, LoadTexture(3, "Geebee2.bmp"))
MaterialCullingMode(2, #PB_Material_NoCulling )
MaterialCullingMode(3, #PB_Material_NoCulling )
CreateSphere(2, 600)
CreateEntity(2, MeshID(2), MaterialID(2), 0, 300, 0)
CreateSphere(3, 610)
CreateEntity(3, MeshID(3), MaterialID(3), 0, 300, 0)
;- Camera
;
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 120, 500, #PB_Absolute)
CameraBackColor(0, $FF)
;- Light
;
CreateLight(0, RGB(255, 255, 255), -40, 100, 80)
AmbientColor(RGB(80, 80, 80))
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -10
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 10
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -10
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 10
Else
KeyY = 0
EndIf
EndIf
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End