This plugin will allow you to have an (almost) limitless level, with as many rooms/areas as you need. It uses a special type of culling, where you create a tree of different elements in the scene.
UPDATED
Example:
Level (Portals to Hall through Door to House)
- Door to House
- House
-- Hall (Portal to Kitchen through Kitchen Door, and to Level through Door to House)
--- Vase
--- Cupboard
-- Kitchen Door
-- Kitchen (Portal to Hall through Kitchen Door)
--- Counter
--- Cooker
Once you have built this tree, the plugin will automatically hide and exclude the objects and limbs which are not visible, and show those which are visible.
Command list:
OT_UpdateFrustum [CameraID as Integer]
OT_CullAll *No parameters*
OT_Cull section as Integer
Return ? as Integer = OT_CreateBox(parent as Integer, x1 as Float, y1 as Float, z1 as Float, x2 as Float, y2 as Float, z2 as Float [, mode as Integer])
Return ? as Integer = OT_CreateSphere(parent as Integer, x as Float, y as Float, z as Float, radius as Float [, mode as Integer])
Return ? as Integer = OT_CreatePoint(parent as Integer, x as Float, y as Float, z as Float [, mode as Integer])
OT_Delete section as Integer
OT_DeleteAll *No parameters*
OT_AddObject section as Integer, ObjNum as Integer
OT_AddLimb section as Integer, ObjNum as Integer, LimbNum as Integer
OT_RemoveObject section as Integer, ObjNum as Integer
OT_RemoveLimb section as Integer, ObjNum as Integer, LimbNum as Integer
Return ? as Dword = OT_Visible(section as Integer)
OT_Hide section as Integer
OT_Show section as Integer
OT_HideAll section as Integer
OT_ShowAll section as Integer
OT_AddPortal SectionA as Integer, SectionB as Integer, PortalSection as Integer
OT_RemovePortal SectionA as Integer, SectionB as Integer, PortalSection as Integer
Section 0 is the root section.
Once you have created a section, you would normally add a number of objects and limbs, to be culled with that section, using 'OT_AddObject' and 'OT_AddLimb'.
I have fixed Math89's example, and altered it to work with the latest version:
sync on : sync rate 60 : autocam off
Set Normalization On
Type Area
name As String
ID As Integer
EndType
dim area(0) As Area
world = createCubeArea(0, -1000,0,- 1000, 1000,1000, 1000, "World",2)
house = createCubeArea(world, 0,0,100, 400,200, 500, "House",2)
hall = createCubeArea(house, 0,0,100, 400,200, 500, "Hall",2)
bigbox = createCubeArea(hall, 100,0,150, 150,20, 200, "big box",2)
insidebox = createCubeArea(bigbox, 110,10,180, 120,13, 190, "little box",2)
door = createCubeArea(world, 200,0,90, 300,160, 110, "Door",1)
null = OT_AddPortal(world,hall,door)
room = createCubeArea(hall, 200,0,300, 400,200, 500, "Room",2)
bedroom = createCubeArea(room, 200,0,300, 400,200, 500, "Room",2)
rdoor = createCubeArea(hall, 195,0,350, 205,160, 450, "Room door",1)
null = OT_AddPortal(hall,bedroom,rdoor)
do
Move Camera (Upkey()-downKey())
ax# = wrapvalue(ax# + mousemovey()*0.2)
ay# = wrapvalue(ay# + mousemovex()*0.2)
Rotate Camera ax#, ay#,0
OT_UpdateFrustum
OT_CullAll
For i = 1 To Array Count(area(0))
message$ = str$(area(i).ID)+" = "+area(i).name+" : "+str$(OT_Visible(area(i).ID) && 255)
Ink 0,0 : Text 1, (i-1)*12+1, message$
Ink -1,0 : Text 0, (i-1)*12, message$
Next i
sync
loop
Function createCubeArea(parent, x,y,z, xx,yy,zz, name$,mode)
obj = freeobj()
Make Object Box obj, xx-x, yy-y, zz-z
Position Object obj, (x+xx)/2, (y+yy)/2, (z+zz)/2
Scale Object obj, -100,100,100
If parent <> 0 then Set Object WireFrame obj, 1
color = rgb( rnd(127)+64,rnd(127)+64,rnd(127)+64)
Set Object Ambience obj, color
Set Object Emissive obj, color
Set Object Diffuse obj, color
area = OT_CreateBox(parent, x, y, z, xx, yy, zz, mode)
OT_AddObject area, Obj
Array Insert At Bottom area(0)
i = Array Count(area(0))
area(i).name = name$
area(i).ID = area
EndFunction area
Function freeObj()
For o = 1 to 65535
If object Exist(o)=0 then exitFunction o
Next o
EndFunction -1
HERE is the download. Put the .dll in your 'compilerplugins-user' folder, and the .ini in the 'editorkeywords' folder.