Jump to content
  • entries
    943
  • comments
    5,899
  • views
    923,767

Something Old, Something New


Josh

2,030 views

 Share

The new CSG editor is coming along nicely. Yesterday I implemented CSG rotation and skewing, and today I got object center and edge selection working. 3D World Studio uses GL_SELECT mode to handle picking in orthographic viewports, but this stopped being supported in ATI drivers a few years ago! I implemented a CPU math routine for picking brush edges. In orthographics viewports, brushes can be selected by clicking their center or any edge, while models only use the center for selection. (This is how Valve's Hammer editor does it.) If this feels weird I can implement an edge-picking algorithm for models, but I think the speed of this would not be good with complex models/scenes.

 

The editor is starting to look and feel like a real editor, and we'll soon be able to start producing the level for our example game. It's neat to see a tool with a modern take on a proven level design technique. I have some map files saving and loading. I'd like to use an ASCII based format if possible, but that may be too slow, especially on mobile. Here's a sample of the file format I am using right now:

Map {
   Version: 3.0
   Brush {
       ID: 203099704
       Name: "Box"
       Position: -0.999999881, 10.0000000, -20.0000000
       Rotation: 0.000000000, 0.000000000, 0.000000000
       Scale: 1.00000000, 1.00000000, 1.00000000
       Color: 1.00000000, 1.00000000, 1.00000000, 1.00000000
       Material: "models\buildings\guardtower\plaster.mat"
       Vertices {
           0: -1.00000000, -10.0000000, -10.0000000
           1: 0.999999881, -10.0000000, -10.0000000
           2: 0.999999881, -10.0000000, 10.0000000
           3: -1.00000000, -10.0000000, 10.0000000
           4: -1.00000000, 10.0000000, -10.0000000
           5: 0.999999881, 10.0000000, -10.0000000
           6: 0.999999881, 10.0000000, 10.0000000
           7: -1.00000000, 10.0000000, 10.0000000
       }
       Face {
           Indices: 0,1,2,3
           Plane: 0.000000000, -1.00000000, 0.000000000, -10.0000000
           MappingPlane[0]: -1.00000000, -0.000000000, -0.000000000, 0.000000000
           MappingPlane[1]: -0.000000000, -1.79489679e-009, -1.00000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
       Face {
           Indices: 7,6,5,4
           Plane: 0.000000000, 1.00000000, 0.000000000, -10.0000000
           MappingPlane[0]: -1.00000000, -0.000000000, -0.000000000, 0.000000000
           MappingPlane[1]: -0.000000000, -1.79489679e-009, 1.00000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
       Face {
           Indices: 0,3,7,4
           Plane: -1.00000000, 0.000000000, 0.000000000, -1.00000000
           MappingPlane[0]: -1.79489679e-009, -0.000000000, -1.00000000, 0.000000000
           MappingPlane[1]: -0.000000000, -1.00000000, -0.000000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
       Face {
           Indices: 5,6,2,1
           Plane: 1.00000000, 0.000000000, 0.000000000, -0.999999881
           MappingPlane[0]: -1.79489679e-009, -0.000000000, 1.00000000, 0.000000000
           MappingPlane[1]: -0.000000000, -1.00000000, -0.000000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
       Face {
           Indices: 4,5,1,0
           Plane: -0.000000000, -0.000000000, -1.00000000, -10.0000000
           MappingPlane[0]: 1.00000000, -0.000000000, 3.58979357e-009, 0.000000000
           MappingPlane[1]: -0.000000000, -1.00000000, -0.000000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
       Face {
           Indices: 6,7,3,2
           Plane: -0.000000000, 0.000000000, 1.00000000, -10.0000000
           MappingPlane[0]: -1.00000000, -0.000000000, -0.000000000, 0.000000000
           MappingPlane[1]: -0.000000000, -1.00000000, -0.000000000, 0.000000000
           Material: "models\buildings\guardtower\plaster.mat"
       }
   }
}

 Share

3 Comments


Recommended Comments

Looks very good.Why you don't use a binary fileformat like a modelfile with chunks for the sections (models) and the other properties like materials.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...