Quote: "The skysphere is a little funny, but that might just be me. "
That's because it's
not a sky sphere, it's an image. It's two actually.
Quote: "Why doesn't it use Hardware?"
Where's the skill in that ?
The original version of the engine was written in DB classic. It became the foundation of the geometry engine used in a visibility tool (
Visible Worlds) that I was tinkering with. The older demo above is a direct (shovel) port of. The update is slightly more pb'ized than the old version, but not much.
Anyway, the purpose of the example isn't to create useful Terrain engine, but rather to demonstrate PlayBasic code execution under stress.
Quote: " Does that not mean it'll run slower than usual?"
You'd get faster drawing, but it spends more time processing geometry than drawing. Further improvements could me made by replacing the rotation code with PlayBasic's built in vertex rotation, but it defeats the purpose of the demo really.
Quote: "Also, I'm interested to see how objects are created (source code). Is it just like DBP?"
The scene creation is this.
For lp =1 To NUmb_of_test_objects_in_world
BumpAnglex#(lp)=Rnd(3)
BumpAngley#(lp)=Rnd(3)
BumpAnglez#(lp)=Rnd(3)
size#=150+Rnd(250)
size1#=50+Rnd(250)
size2#=50+Rnd(250)
t=Rnd(2)
objecttype=Rnd(9)
If ObjectTYpe=0
Make_Object_Cube(lp,size#)
Randomly_Rip_EverySecondface(lp)
EndIf
If ObjectTYpe=1
Make_Object_Box(lp,size#,10.0,145.0)
EndIf
If ObjectTYpe=2
Make_Object_Sphere(lp,size#,SphereBaseDetailLevel#+Rnd(SphereBaseDetailLevel#*0.55))
Randomly_Rip_EverySecondface(lp)
EndIf
If ObjectTYpe=3
f#=TorusBaseDetailLevel#+(Rnd(TorusBaseDetailLevel#/2))
f2#=f#+(f#*0.3)
Make_Object_Torus(lp,Size#,Size#*0.65,f#,f#)
Randomly_Rip_EverySecondface(lp)
EndIf
If ObjectTYpe=4
Make_Object_Disc(lp,size#,DIscBaseDetailLevel#)
Show_object_backfaces(lp)
Randomly_Rip_EverySecondface(lp)
EndIf
If ObjectTYpe=5
Make_Object_cone(lp,size#,ConeBaseDetailLevel#)
Randomly_Rip_EverySecondface(lp)
Set_Object_rotation_ZYX(lp)
EndIf
If ObjectTYpe=6
Make_Object_tube(lp,size#,TubeBaseDetailLevel#)
Randomly_Rip_EverySecondface(lp)
EndIf
If ObjectTYpe=7
Make_Object_plane(lp,size#,size#/2)
Show_object_backfaces(lp)
EndIf
If ObjectTYpe=8
x1#=Rnd(100)
x2#=Rnd(100)
x3#=Rnd(100)
y1#=Rnd(100)
y2#=Rnd(100)
y3#=Rnd(100)
z1#=Rnd(100)
z2#=Rnd(100)
z3#=Rnd(100)
col=RGB(0,255,0)
Make_Object_Polygon(lp,x1#,y1#,z1#,x2#,y2#,z2#,x3#,y3#,z3#,col)
Show_object_backfaces(lp)
EndIf
If ObjectTYpe=9
Make_Object_VertexPlane(lp,size#,size#,10,10)
Show_object_backfaces(lp)
EndIf
Faces=Get_objects_numb_of_faces(lp)
POlysInWorld=POlysInWorld+faces
x#=Rnd(world_width)
z#=Rnd(world_Depth)
y#=Get_ground_height(matrix,x#,z#)+(size#*1.35)
Position_Object(Lp,X#,Y#,Z#)
Next lp
Quote: "Stupid question, but is that OpenGL or DirectX in the background? Because I can't run any DX apps at the moment, but recently I found out OpenGL apps will run fine."
It's a DX DirectDraw surface.
Quote: " I see screen tearing, though. Is there a way to vertical sync in Playbasic?"
Yes ,just enable it with ScreenVSYNC ON/OFF