public class DPlane implements DStruct { public Vector3f normal; // Plane normal vector public float dist; // Distance from origin public int type; // Plane axis type}
Size: 20 bytesFields:
normal - Unit normal vector perpendicular to the plane
dist - Distance from world origin along the normal
type - Axial plane type (0-5 for axis-aligned, 6 for arbitrary)
public class DFace implements DStruct { public static final int MAXLIGHTMAPS = 4; public int pnum; // Plane number public byte side; // Side of plane (0 or 1) public byte onnode; // 1 if on node, 0 if in leaf public int fstedge; // First surfedge index public int numedge; // Number of surfedges public int texinfo; // Texture info index public int dispInfo; // Displacement info index (-1 if not a displacement) public int surfaceFogVolumeID; // Fog volume ID public byte[] styles; // Lightmap styles [MAXLIGHTMAPS] public int lightofs; // Offset into lightmap data public float area; // Face area in square units public int[] lightmapTextureMinsInLuxels; // [2] Lightmap mins public int[] lightmapTextureSizeInLuxels; // [2] Lightmap size public int origFace; // Original face index public int numPrims; // Number of primitives public int firstPrimID; // First primitive ID public int smoothingGroups; // Smoothing groups}
Size: 56 bytes
Show Field Details
pnum - Index into the planes lump
side - Which side of the plane (0 = front, 1 = back)
fstedge - Index into surfedges lump
numedge - Number of consecutive surfedges forming this face
texinfo - Index into texinfo lump for texture mapping
dispInfo - Index into dispinfo lump, or -1 if not a displacement surface
styles - Up to 4 lightmap styles for dynamic lighting
public class DBrush implements DStruct { public int fstside; // First brush side index public int numside; // Number of sides public Set<BrushFlag> contents; // Contents flags}
public class DModel implements DStruct { public Vector3f mins; // Bounding box minimum public Vector3f maxs; // Bounding box maximum public Vector3f origin; // Model origin public int headnode; // BSP tree head node index public int fstface; // First face index public int numface; // Number of faces}
Size: 48 bytesFields:
mins / maxs - Axis-aligned bounding box
origin - Origin point of the model
headnode - Root node of this model’s BSP tree
fstface - Index of first face in the faces lump
numface - Number of consecutive faces belonging to this model
public class DTexInfo implements DStruct { public static final int TEXINFO_NODE = -1; public float[][] textureVecsTexels; // [2][4] Texture UV mapping public float[][] lightmapVecsLuxels; // [2][4] Lightmap UV mapping public Set<SurfaceFlag> flags; // Surface flags public int texdata; // Texture data index}
Size: 72 bytes
Show Texture Mapping
The texture vectors define how world coordinates map to texture coordinates:
public class DDispInfo implements DStruct { public static final int DISP_INFO_FLAG_HAS_MULTIBLEND = 0x40000000; public static final int DISP_INFO_FLAG_MAGIC = 0x80000000; public Vector3f startPos; // Starting position public int dispVertStart; // Index into disp verts public int dispTriStart; // Index into disp tris public int power; // Displacement power (2-4) public int minTess; // Minimum tesselation public float smoothingAngle; // Smoothing angle public int contents; // Surface contents public int mapFace; // Face index public int lightmapAlphaStart; // Lightmap alpha start public int lightmapSamplePositionStart; public int[] allowedVerts; // [10] Allowed vertices}
public class DOverlay implements DStruct { public static final int OVERLAY_BSP_FACE_COUNT = 64; public int id; // Overlay ID public int texinfo; // Texture info index public int faceCountAndRenderOrder; public int[] ofaces; // [64] Face indices public float[] u; // [2] U texture coords public float[] v; // [2] V texture coords public Vector3f[] uvpoints; // [4] UV points public Vector3f origin; // Overlay origin public Vector3f basisNormal; // Basis normal}
Size: 352 bytes
Show Helper Methods
int getFaceCount()
Returns the number of faces this overlay is applied to.
int getRenderOrder()
Returns the render order (0-3) for overlapping overlays.
for (DModel model : bspData.models) { System.out.println("Model bounds: " + model.mins + " to " + model.maxs); // Iterate through model's faces for (int i = 0; i < model.numface; i++) { DFace face = bspData.faces.get(model.fstface + i); // Process face... }}for (DBrush brush : bspData.brushes) { if (brush.isPlayerClip()) { System.out.println("Found player clip brush"); } // Iterate through brush sides for (int i = 0; i < brush.numside; i++) { DBrushSide side = bspData.brushSides.get(brush.fstside + i); // Process brush side... }}