BSP Factory relaunched!!! Version 1.2 available

Community Forums/Developer Stations/BSP Factory relaunched!!! Version 1.2 available

JaviCervera(Posted 2004) [#1]
BSP Factory 1.2 has been finally finished.

BSP Factory loads a BSP file -Quake(TM) or Half-Life(TM) version-, lightmaps it, and exports to several formats.

The new version of BSP Factory, amongst other things, will allow you to write exporters in simple scripts to export to any file format you want. It includes exporters for .b3d and .x formats, although I have written some more. I want to post these exporters on different forums first to ensure that they do work correctly, and then i'll add them to the package. I have exporters for gile[s], OGRE, NeoEngine, Pulsar LMTools, and some more.

All the people who bought it through Binary-People, please send me your Share-It receipt (an e-mail from them which demonstrates that you bought it) to receive the update. I told Binary People to send me the list of people who bought it, but they didn't :P Sorry this is the only way I know to continue giving support to these users.

Visit BSP Factory homepage for screenshots, demo, examples and purchase (12.95):

http://www.bspfactory.tk


JaviCervera(Posted 2004) [#2]
I have added links to the demo and examples to the previous post. Enjoy! :D


jfk EO-11110(Posted 2004) [#3]
cool tool. funny rocket logo in the DB example :)


JaviCervera(Posted 2004) [#4]
For those of you who missed the post in the gile[s] forums, here it is the .gls exporter:

Global lightIntensity#
Global lightToon
Global lightToonShades

Function ExportFormat$()
Return "Gile[s] Scene (*.gls)|*.gls"
End Function

;-------------------------------------------------

;Tells BSP Factory not to save the lightmap
Function ExportLightmap()
Return False
End Function

;-------------------------------------------------

Function Export()

;Get settings
GadgetList "gile[s] Exporter Settings:", 200
AddText "Light intensity multiplier (multiplies range):"
AddString "0.01"
AddCheckBox "Export lights as toon lights", 0
AddText "Toon shades:"
AddSpin 1, 1024, 3
OpenGadgetList
lightIntensity = GadgetListResult(1)
lightToon = GadgetListResult(2)
lightToonShades = GadgetListResult(3)

;Write header
FileInt      $FFFF         ;HEADER chunk
HEADER_begin=FileGetPos()   ;Offset to the size info
FileInt      0            ;TmpSize
FileString   "gile[s]"
FileFloat   1.0            ;Version

;Write author comments
FileInt      $F000            ;AUTHOR Chunk
FileInt      Len("Exported by BSP Factory")+1   ;Size of the chunk (len of string + 1)
FileString   "Exported by BSP Factory"         ;Comment

;Write lightmaps
WriteGLSLightmaps

;Write textures
WriteGLSTextures

;Write materials
WriteGLSMaterials

;Write models
WriteGLSModels

;End of HEADER
HEADER_end=FileGetPos()
FileSetPos   HEADER_begin
FileInt   HEADER_end-HEADER_begin-4
FileSetPos   HEADER_end

End Function

;-------------------------------------------------

Function WriteGLSLightmaps()

;Begin
FileInt   $7000      ;LIGHTMAPS Chunk
LIGHTMAPS_begin=FileGetPos()
FileInt   0      ;TmpSize

;Texture Begin
FileInt   $7001      ;LIGHTMAP Chunk
LIGHTMAP_begin=FileGetPos()
FileInt   0      ;TmpSize

;Name
FileInt      $7002
FileInt      Len("Default Lightmap")+1
FileString   "Default Lightmap"

;File
FileInt      $7003
FileInt      1
FileByte   0

;Width
FileInt      $7004
FileInt      2
FileShort   512

;Height
FileInt      $7005
FileInt      2
FileShort   512

;Non uniform
;FileInt      $7006
;FileInt      1
;FileByte   1

;Use custom texel
;FileInt      $7007
;FileInt      1
;FileByte   0

;Custom texel
;FileInt      $7008
;FileInt      4
;FileFloat   0.0;1.17063

;Repack
;FileInt      $7009
;FileInt      1
;FileByte   1

;Data (completely white)
FileInt      $700A
FileInt      512*512*3
For c=1 To 512*512*3
   FileByte 255
Next

;Size
LIGHTMAP_end=FileGetPos()
FileSetPos   LIGHTMAP_begin
FileInt   LIGHTMAP_end-LIGHTMAP_begin-4
FileSetPos   LIGHTMAP_end

;Size
LIGHTMAPS_end=FileGetPos()
FileSetPos   LIGHTMAPS_begin
FileInt   LIGHTMAPS_end-LIGHTMAPS_begin-4
FileSetPos   LIGHTMAPS_end

End Function

;-------------------------------------------------

Function WriteGLSTextures()

;Begin
FileInt   $6000      ;TEXTURES Chunk
TEXTURES_begin=FileGetPos()
FileInt   0      ;TmpSize

;Textures
For c=1 To MapSurfaces()
   WriteGLSTex c
Next

;Size
TEXTURES_end=FileGetPos()
FileSetPos   TEXTURES_begin
FileInt   TEXTURES_end-TEXTURES_begin-4
FileSetPos   TEXTURES_end

End Function

;-------------------------------------------------

Function WriteGLSTex(surf)

;Begin
FileInt   $6001   ;TEX Chunk
TEX_begin=FileGetPos()
FileInt   0      ;TmpSize

;File
FileInt      $6002
FileInt      Len(SurfaceTextureName$(surf))+1
FileString   SurfaceTextureName$(surf)

;Scale U
FileInt      $6003
FileInt      4
FileFloat   1.0

;Scale V
FileInt      $6004
FileInt      4
FileFloat   1.0

;Offset U
FileInt      $6005
FileInt      4
FileFloat   -1.0

;Offset V
FileInt      $6006
FileInt      4
FileFloat   -1.0

;Angle
FileInt      $6007
FileInt      4
FileFloat   0.0

;Flags
FileInt      $6008
FileInt      4
FileInt      SurfaceTextureFlags(surf)

;Blend
FileInt      $6009
FileInt      4
FileInt      2

;Size
TEX_end=FileGetPos()
FileSetPos   TEX_begin
FileInt   TEX_end-TEX_begin-4
FileSetPos   TEX_end

End Function

;-------------------------------------------------

Function WriteGLSMaterials()

;Begin
FileInt   $5000      ;MATERIALS Chunk
MATERIALS_begin=FileGetPos()
FileInt   0      ;TmpSize

;Textures
For c=1 To MapSurfaces()
   WriteGLSMat c
Next

;Size
MATERIALS_end=FileGetPos()
FileSetPos   MATERIALS_begin
FileInt   MATERIALS_end-MATERIALS_begin-4
FileSetPos   MATERIALS_end

End Function

;-------------------------------------------------

Function WriteGLSMat(surf)

;Begin
FileInt   $5001   ;MAT Chunk
MAT_begin=FileGetPos()
FileInt   0   ;TmpSize

;Name
FileInt      $5002
FileInt      Len(SurfaceTextureName$(surf))+1
FileString   SurfaceTextureName$(surf)

;Red
FileInt      $5003
FileInt      4
FileFloat   1.0

;Green
FileInt      $5004
FileInt      4
FileFloat   1.0

;Blue
FileInt      $5005
FileInt      4
FileFloat   1.0

;Alpha
FileInt      $5006
FileInt      4
FileFloat   1.0

;Self Illumination
FileInt      $5007
FileInt      4
FileFloat   0.0

;Shininess
FileInt      $5008
FileInt      4
If (SurfaceTextureFlags(surf) And 4096)=4096 Then FileFloat 0.0 Else FileFloat SpecularPower()/100.0

;FX
FileInt      $5009
FileInt      4
FileInt      1

;Blend
FileInt      $500A
FileInt      4
FileInt      1

;Light method
FileInt      $500B
FileInt      1
If  (SurfaceTextureFlags(surf) And 2)=2 Or (SurfaceTextureFlags(surf) And 2048)=2048
   FileByte 0
Else
   FileByte 2

   ;Lightmap
   FileInt      $500C
   FileInt      2
   FileShort   1
End If

;Tex layer
FileInt      $5012
FileInt      3
FileByte   0
FileShort   surf-1

;Size
MAT_end=FileGetPos()
FileSetPos   MAT_begin
FileInt   MAT_end-MAT_begin-4
FileSetPos   MAT_end

End Function

;-------------------------------------------------

Function WriteGLSModels()

;Begin
FileInt   $1000      ;MODELS Chunk
MODELS_begin=FileGetPos()
FileInt   0      ;TmpSize

;Write mesh
WriteGLSMap

;Write all the entities
For c=1 To MapEntities()
   WriteGLSEntity c
Next

;Size
MODELS_end=FileGetPos()
FileSetPos   MODELS_begin
FileInt   MODELS_end-MODELS_begin-4
FileSetPos   MODELS_end

End Function

;-------------------------------------------------

Function WriteGLSMap()

;Begin
FileInt   $1001      ;MODEL Chunk
MODEL_begin=FileGetPos()
FileInt   0      ;TmpSize

;Name
FileInt   $1002   ;MODEL_NAME Chunk
FileInt   Len(MapProperties$())+1
FileString   MapProperties$()

;Position
FileInt   $1003   ;MODEL_POSITION Chunk
FileInt   12
FileFloat   0
FileFloat   0
FileFloat   0

;Rotation
FileInt   $1004   ;MODEL_ROTATION Chunk
FileInt   12
FileFloat   0
FileFloat   0
FileFloat   0

;Scale
FileInt   $1005   ;MODEL_SCALE Chunk
FileInt   12
FileFloat   1.0
FileFloat   1.0
FileFloat   1.0

;Custom props
FileInt   $1006   ;CUSTOM_PROPS Chunk
FileInt   1
FileByte   0

;Hidden
FileInt   $1008   ;HIDDEN Chunk
FileInt   1
FileByte   0

WriteGLSMesh

;Size
MODEL_end=FileGetPos()
FileSetPos   MODEL_begin
FileInt   MODEL_end-MODEL_begin-4
FileSetPos   MODEL_end

End Function

;-------------------------------------------------

Function WriteGLSEntity(model)

;Begin
FileInt   $1001      ;MODEL Chunk
MODEL_begin=FileGetPos()
FileInt   0      ;TmpSize

;Name
FileInt   $1002   ;MODEL_NAME Chunk
FileInt   Len(MapEntityProperties$(model))+1
FileString   MapEntityProperties$(model)

;Position
FileInt   $1003   ;MODEL_POSITION Chunk
FileInt   12
FileFloat   MapEntityX#(model)
FileFloat   MapEntityY#(model)
FileFloat   MapEntityZ#(model)

;Rotation
FileInt   $1004   ;MODEL_ROTATION Chunk
FileInt   12
FileFloat   0
FileFloat   0
FileFloat   0

;Scale
FileInt   $1005   ;MODEL_SCALE Chunk
FileInt   12
FileFloat   1.0
FileFloat   1.0
FileFloat   1.0

;Custom props
FileInt   $1006   ;CUSTOM_PROPS Chunk
FileInt   1
FileByte   0

;Hidden
FileInt   $1008   ;HIDDEN Chunk
FileInt   1
FileByte   0

If MapEntityProperty$(model, "classname")="light"
   WriteGLSLight   model
Else
   WriteGLSPivot   model
End If

;Size
MODEL_end=FileGetPos()
FileSetPos   MODEL_begin
FileInt   MODEL_end-MODEL_begin-4
FileSetPos   MODEL_end

End Function

;-------------------------------------------------

Function WriteGLSMesh()

;Begin
FileInt   $2000      ;MESH Chunk
MESH_begin=FileGetPos()
FileInt   0      ;TmpSize

;OVERRIDE
FileInt   $2001
FileInt   1
FileByte   0

;BACKLIGHT
FileInt   $2002
FileInt   1
FileByte   0

;RECEIVESHADOW
FileInt   $2003
FileInt   1
FileByte   1

;CASTSHADOW
FileInt   $2004
FileInt   1
FileByte   1

;RECEIVEGI
FileInt   $2005
FileInt   1
FileByte   1

;AFFECTGI
FileInt   $2006
FileInt   1
FileByte   1

;Write mesh surfaces
WriteGLSSurfaces

;Size
MESH_end=FileGetPos()
FileSetPos   MESH_begin
FileInt   MESH_end-MESH_begin-4
FileSetPos   MESH_end

End Function

;-------------------------------------------------

Function WriteGLSSurfaces()

;Begin
FileInt   $2100      ;MESH_SURFACES Chunk
MESH_SURFACES_begin=FileGetPos()
FileInt   0      ;TmpSize

For c=1 To MapSurfaces()
   WriteGLSSurf  c
Next

;Size
MESH_SURFACES_end=FileGetPos()
FileSetPos   MESH_SURFACES_begin
FileInt   MESH_SURFACES_end-MESH_SURFACES_begin-4
FileSetPos   MESH_SURFACES_end

End Function

;-------------------------------------------------

Function WriteGLSSurf(surf)

;Begin
FileInt   $2101      ;MESH_SURF Chunk
MESH_SURF_begin=FileGetPos()
FileInt   0      ;TmpSize

;Number of vertices
FileInt   $2102   ;MESH_SURFVERTS Chunk
FileInt   2
FileShort   SurfaceVertices(surf)

;Number of polygons
FileInt   $2103   ;MESH_SURFPOLYS Chunk
FileInt   2
FileShort   SurfaceTriangles(surf)

;Material index
FileInt   $2104   ;MESH_SURFMATERIAL Chunk
FileInt   4
FileInt   surf-1

;Vertex format
FileInt   $2105   ;MESH_SURFVERTFORMAT Chunk
FileInt   4
FileInt   1+16

;Vertex data
FileInt   $2106   ;MESH_SURFVERTDATA Chunk
FileInt   32
For c=0 To SurfaceVertices(surf)-1
   FileFloat   SurfaceVertexX#(surf,c)
   FileFloat   SurfaceVertexY#(surf,c)
   FileFloat   SurfaceVertexZ#(surf,c)
   FileFloat   SurfaceVertexNX#(surf,c)
   FileFloat   SurfaceVertexNY#(surf,c)
   FileFloat   SurfaceVertexNZ#(surf,c)
   FileFloat   SurfaceVertexU#(surf,c,0)
   FileFloat   SurfaceVertexV#(surf,c,0)
Next

;Poly data
FileInt   $2107      ;MESH_SURFPOLYDATA Chunk
FileInt   6
For c=0 To SurfaceTriangles(surf)-1
   FileShort   SurfaceTriangle(surf,c,0)
   FileShort   SurfaceTriangle(surf,c,1)
   FileShort   SurfaceTriangle(surf,c,2)
Next

;Size
MESH_SURF_end=FileGetPos()
FileSetPos   MESH_SURF_begin
FileInt   MESH_SURF_end-MESH_SURF_begin-4
FileSetPos   MESH_SURF_end

End Function

;-------------------------------------------------

Function WriteGLSPivot(pivot)
FileInt   $3000
FileInt   0
End Function

;-------------------------------------------------

Function WriteGLSLight(light)

;Begin
FileInt   $4000
LIGHT_begin=FileGetPos()
FileInt   0      ;TmpSize

;LIGHT_TYPE
FileInt      $4001
FileInt      1
FileByte   2

;LIGHT_ACTIVE
;FileInt   $4002
;FileInt   1
;FileByte   1

;LIGHT_CASTSHADOWS
;FileInt   $4003
;FileInt   1
;FileByte   1

;LIGHT_INFINITE
FileInt      $4004
FileInt      1
FileByte   0   ;Not infinite

;RED
FileInt   $4007
FileInt   4
FileFloat   Float#(StringField$(MapEntityProperty$(light,"_light"),1))/255.0

;GREEN
FileInt   $4008
FileInt   4
FileFloat   Float#(StringField$(MapEntityProperty$(light,"_light"),2))/255.0

;BLUE
FileInt   $4009
FileInt   4
FileFloat   Float#(StringField$(MapEntityProperty$(light,"_light"),3))/255.0

;INTENSITY
FileInt   $400A
FileInt   4
FileFloat   Float#(StringField$(MapEntityProperty$(light,"_light"),4)) * lightIntensity#

;LIGHT_NEAR
;FileInt   $400B
;FileInt   4
;FileFloat   0

;LIGHT_FAR
FileInt   $400C
FileInt   4
FileFloat   Float#(StringField$(MapEntityProperty$(light,"_light"),4))*2

;LIGHT_TOON
FileInt      $400F
FileInt      1
FileByte   lightToon

;LIGHT_TOON_SHADES
FileInt      $4010
FileInt      1
FileByte   lightToonShades

;Size
LIGHT_end=FileGetPos()
FileSetPos   LIGHT_begin
FileInt   LIGHT_end-LIGHT_begin-4
FileSetPos   LIGHT_end

End Function


Save this file as gls.export in the Plugins folder of BSP Factory (only works with the full version).


JaviCervera(Posted 2004) [#5]
Also, I have launched the BSP Factory website:

http://www.bspfactory.tk


gotelin(Posted 2004) [#6]
I have escenary in Max, Is there a plugin for export to BSP and read with BSp Factory?
Thanks for all


JaviCervera(Posted 2004) [#7]
If you use Max, why would you want to use BSP Factory? Use B3D Pipeline, which exports a max scene to .b3d with all the texture and brush properties that Blitz does support.