Hi Pete, haven't seen much activity from you lately, how are you getting on with your modified YAL, any luck there or have you abandoned the idea of allowing the user to create levels from prefabs and then lightmap them at runtime with YAL.
Pete Carter - YAL
Blitz3D Forums/Blitz3D Programming/Pete Carter - YAL I have a completed version of this using types. Note though that addmesh() when used in this function can produce strange issues with collision detection. If you want I can clean it up and email it to you rather busy at the moment though.
Thanks VErt|g0, that would be great. If its too big a job to clean up then just send it as it is (as long as it works).
Cheers
Cheers
Ok to sum it up you'll need to set an array for the objects and textures and use copyentity aswell as paintbrush for the prefab parts. This basically takes a Light type and creates lm lights in yal. Good luck, the system this is pulled out of is rather cluttered and im too busy to make it a lib... the general concept is here, and im sure you can figure out how to make your own system. You need yal of course.
Types etc...
The following are used for occlusion etc.
Here is the function... good luck.
Types etc...
Type obj Field entity Field part% Field zone Field texture% Field selected Field group$ Field x#,y#;,z# Field rx#,ry#,rz# End Type Type lm_obj Field entity Field part% Field zone Field texture% Field selected Field group$ Field x#,y#;,z# Field rx#,ry#,rz# End Type Type light Field entity Field entity_o Field ent_range Field ent_brightness Field X#,Y#,Z# Field R%,G%,B% Field zone% Field range% Field brightness% Field selected End Type Type section Field number% Field name$ Field visible$ Field mesh End Type Dim brush_texture(Total_textures%) Dim texture(Total_textures%) Dim block(Total_block_parts%)
The following are used for occlusion etc.
For secload=1 To 100 sec.section=New section sec\number% = secload sec\name$ = "" sec\visible$ = Str$(secload) sec\mesh = CreateCube() EntityAlpha sec\mesh,0.0 HideEntity sec\mesh Next ;Create collision mesh based on parts then hide them, only displaying the lightmapped final mesh. For o.obj = Each obj EntityType O\entity,type_ground EntityAlpha O\entity,0 ; FreeEntity O\entity ; Delete o Next
Here is the function... good luck.
Function light_map(section%) first_selection = False For O.obj=Each obj If O\zone% = section% Then LM.lm_obj=New lm_obj LM\entity = CopyMesh (block(O\part%)) LM\X# = O\X# LM\Y# = O\Y# LM\Z# = O\Z# LM\RX# = O\RX# LM\RY# = O\RY# LM\RZ# = O\RZ# LM\texture% = O\texture% EntityFX LM\entity,1 PaintMesh LM\entity,brush_texture( LM\texture% ) RotateMesh LM\entity, LM\RX#, LM\RY#, LM\RZ# PositionMesh LM\entity, LM\X#, LM\Y#, LM\Z# EntityPickMode LM\entity,2 If first_selection = False Then PositionEntity temp_piv,EntityX(O\entity),EntityY(O\entity),EntityZ(O\entity) first_selection = True End If last_x# = O\X# last_y# = O\y# last_z# = O\z# End If Next If first_selection=False Then Return For S.section = Each section If S\number% = section% Then FreeEntity S\mesh S\mesh = CreateMesh() NameEntity( S\mesh, S\number% ) For N.lm_obj = Each lm_obj AddMesh N\entity,S\mesh Next ThisObscurer.LMObscurer = New LMObscurer ThisObscurer\Entity = S\mesh BeginLightMap(Ambient_r%, Ambient_g%, Ambient_b%) For L.light= Each light If L\zone% = section% CreateLMLight( L\X#, L\Y#, L\Z#, L\R%,L\G%,L\B%, L\range%, False, L\brightness%) End If Next tex = LightMapMesh(S\mesh, 2.0, 256, 0, "Lightmapping " + EntityName(S\mesh)) lm_folder$ = "maps" + map_name$ + "" If tex SaveLightMap(S\mesh, tex, lm_folder$ + EntityName(S\mesh) + ".bmp", lm_folder$ + EntityName(S\mesh) + ".luv") ApplyLightMap(S\mesh, tex) EndIf EndLightMap() For R.lm_obj=Each lm_obj FreeEntity R\entity Delete R Next For M.LMLight= Each LMLight Delete M Next End If Next End Function
hi, Have left it for now working on the game controls at the moment and the car movement. I thinking now i will make a level editor as a extra program and have the game load from saved files, this way i can add in this function later.