|
Chunks
Moddable voxel sandbox for room-scale VR.
|
Helper class used to procedurally generate 3D models. More...
Public Member Functions | |
| ModelGenerator (PrimitiveType primitiveType) | |
| ModelGenerator (float scale, PrimitiveType primitiveType) | |
| Constructs a new ModelGenerator with the specified vertex position scale and face primitive type. More... | |
| ModelGenerator (float scale, Vector offset, PrimitiveType primitiveType) | |
| Constructs a new ModelGenerator with the specified vertex position scale, offset, and face primitive type. More... | |
| void | Clear () |
| Removes all vertex data and face indices from the generated model. More... | |
| int | AddVertex (Vector position, Vector texCoords, Vector normal, Color color, Surface surface) |
| int | AddVertex (Vector position, Vector texCoords, Vector normal, Vector tangent, Color color, Surface surface) |
| Adds a single vertex to the generated model, returning its vertex index. More... | |
| void | AddQuad (Vector a, Vector b, Vector c, Vector d, Vector uvMin, Vector uvMax, Color color, Surface surface=null) |
| Adds a quad face to the generated model using the given vertex positions, minimum and maximum texture coordinates, vertex color, and surface info. More... | |
| void | AddQuad (Vector min, Vector max, Color color, Surface surface=null) |
| void | AddQuad (Vector a, Vector b, Vector c, Vector d, Vector uvA, Vector uvB, Vector uvC, Vector uvD, Color color, Surface surface) |
| Adds a quad face to the generated model using the given vertex positions, texture coordinates, vertex color, and surface info. More... | |
| void | AddBox (Vector origin, Vector right, Vector up, Vector forward, Vector uvMin, Vector uvMax, Color color, Surface surface=null) |
| Adds six quad faces in the shape of a parallelepiped defined by one corner position and three vectors for each of the edges from that corner to its neighbours. More... | |
| void | AddBox (Vector size, Color color, Surface surface=null) |
| void | AddBox (Vector center, Vector size, Color color, Surface surface=null) |
| void | AddQuadIndices (int indexA, int indexB, int indexC, int indexD) |
| Adds a quad face defined by the indices of four vertices. More... | |
| void | AddQuad (BlockVertex a, BlockVertex b, BlockVertex c, BlockVertex d) |
| Adds a quad face defined by four vertices. More... | |
| void | AddQuad (IntVector min, IntVector max, Face face, Surface surface) |
| Adds a quad face defined as one of the faces of an axis aligned box. More... | |
| void | AddBox (IntVector min, IntVector max, [NotNull] Block block) |
| Adds an axis aligned box with surface textures taken from a Block. More... | |
| void | AddBox (IntVector min, IntVector max, [NotNull] Surface surface) |
| Adds an axis aligned box with the same texture on each face. More... | |
| void | AddBox (IntVector min, IntVector max, Surface xMinSurface, Surface xMaxSurface, Surface yMinSurface, Surface yMaxSurface, Surface zMinSurface, Surface zMaxSurface) |
| Adds an axis aligned box with specified textures on each face. More... | |
Public Attributes | |
| bool | HasIndices => _indices.Count > 0 |
| Returns true if the model currently has any face indices. More... | |
Properties | |
| float | Scale [get, set] |
| Vector | Offset [get, set] |
Helper class used to procedurally generate 3D models.
| Chunks.Graphics.ModelGenerator.ModelGenerator | ( | PrimitiveType | primitiveType | ) |
| Chunks.Graphics.ModelGenerator.ModelGenerator | ( | float | scale, |
| PrimitiveType | primitiveType | ||
| ) |
Constructs a new ModelGenerator with the specified vertex position scale and face primitive type.
| scale | The amount each vertex position should be scaled by |
| primitiveType | The PrimitiveType of each face |
| Chunks.Graphics.ModelGenerator.ModelGenerator | ( | float | scale, |
| Vector | offset, | ||
| PrimitiveType | primitiveType | ||
| ) |
Constructs a new ModelGenerator with the specified vertex position scale, offset, and face primitive type.
| scale | The amount each vertex position should be scaled by |
| offset | The amount to offset each vertex position |
| primitiveType | The PrimitiveType of each face |
| void Chunks.Graphics.ModelGenerator.AddBox | ( | Vector | origin, |
| Vector | right, | ||
| Vector | up, | ||
| Vector | forward, | ||
| Vector | uvMin, | ||
| Vector | uvMax, | ||
| Color | color, | ||
| Surface | surface = null |
||
| ) |
Adds six quad faces in the shape of a parallelepiped defined by one corner position and three vectors for each of the edges from that corner to its neighbours.
| origin | Starting corner of the box |
| right | Vector from the origin to the first neighbouring corner |
| up | Vector from the origin to the second neighbouring corner |
| forward | Vector from the origin to the third neighbouring corner |
| uvMin | Minimum texture coordinate |
| uvMax | Maximum texture coordinate |
| color | Face color |
| surface | Face surface info, used for texturing |
| void Chunks.Graphics.ModelGenerator.AddBox | ( | Vector | center, |
| Vector | size, | ||
| Color | color, | ||
| Surface | surface = null |
||
| ) |
Adds an axis aligned box with surface textures taken from a Block.
| min | Minimum bounds of the box |
| max | Maximum bounds of the box |
| block | Block type used for texturing |
| void Chunks.Graphics.ModelGenerator.AddBox | ( | IntVector | min, |
| IntVector | max, | ||
| [NotNull] Surface | surface | ||
| ) |
Adds an axis aligned box with the same texture on each face.
| min | Minimum bounds of the box |
| max | Maximum bounds of the box |
| surface | Surface used for texturing |
| void Chunks.Graphics.ModelGenerator.AddBox | ( | IntVector | min, |
| IntVector | max, | ||
| Surface | xMinSurface, | ||
| Surface | xMaxSurface, | ||
| Surface | yMinSurface, | ||
| Surface | yMaxSurface, | ||
| Surface | zMinSurface, | ||
| Surface | zMaxSurface | ||
| ) |
Adds an axis aligned box with specified textures on each face.
| min | Minimum bounds of the box |
| max | Maximum bounds of the box |
| xMinSurface | Surface to use for texturing the face point towards -X |
| xMaxSurface | Surface to use for texturing the face point towards +X |
| yMinSurface | Surface to use for texturing the face point towards -Y |
| yMaxSurface | Surface to use for texturing the face point towards +Y |
| zMinSurface | Surface to use for texturing the face point towards -Z |
| zMaxSurface | Surface to use for texturing the face point towards +Z |
| void Chunks.Graphics.ModelGenerator.AddQuad | ( | Vector | a, |
| Vector | b, | ||
| Vector | c, | ||
| Vector | d, | ||
| Vector | uvMin, | ||
| Vector | uvMax, | ||
| Color | color, | ||
| Surface | surface = null |
||
| ) |
Adds a quad face to the generated model using the given vertex positions, minimum and maximum texture coordinates, vertex color, and surface info.
| void Chunks.Graphics.ModelGenerator.AddQuad | ( | Vector | min, |
| Vector | max, | ||
| Color | color, | ||
| Surface | surface = null |
||
| ) |
| void Chunks.Graphics.ModelGenerator.AddQuad | ( | Vector | a, |
| Vector | b, | ||
| Vector | c, | ||
| Vector | d, | ||
| Vector | uvA, | ||
| Vector | uvB, | ||
| Vector | uvC, | ||
| Vector | uvD, | ||
| Color | color, | ||
| Surface | surface | ||
| ) |
Adds a quad face to the generated model using the given vertex positions, texture coordinates, vertex color, and surface info.
| a | First vertex position |
| b | Second vertex position |
| c | Third vertex position |
| d | Fourth vertex position |
| uvA | First texture coordinate |
| uvB | Second texture coordinate |
| uvC | Third texture coordinate |
| uvD | Fourth texture coordinate |
| color | Face color |
| surface | Face surface info, used for texturing |
| void Chunks.Graphics.ModelGenerator.AddQuad | ( | BlockVertex | a, |
| BlockVertex | b, | ||
| BlockVertex | c, | ||
| BlockVertex | d | ||
| ) |
Adds a quad face defined by four vertices.
| a | First vertex |
| b | Second vertex |
| c | Third vertex |
| d | Fourth vertex |
| void Chunks.Graphics.ModelGenerator.AddQuad | ( | IntVector | min, |
| IntVector | max, | ||
| Face | face, | ||
| Surface | surface | ||
| ) |
Adds a quad face defined as one of the faces of an axis aligned box.
| min | Minimum bounds of the box the quad is a face of |
| max | Maximum bounds of the box the quad is a face of |
| face | Face of the box the quad is generated from |
| surface | Face surface info, used for texturing |
| void Chunks.Graphics.ModelGenerator.AddQuadIndices | ( | int | indexA, |
| int | indexB, | ||
| int | indexC, | ||
| int | indexD | ||
| ) |
Adds a quad face defined by the indices of four vertices.
| indexA | First vertex index |
| indexB | Second vertex index |
| indexC | Third vertex index |
| indexD | Fourth vertex index |
| int Chunks.Graphics.ModelGenerator.AddVertex | ( | Vector | position, |
| Vector | texCoords, | ||
| Vector | normal, | ||
| Color | color, | ||
| Surface | surface | ||
| ) |
| int Chunks.Graphics.ModelGenerator.AddVertex | ( | Vector | position, |
| Vector | texCoords, | ||
| Vector | normal, | ||
| Vector | tangent, | ||
| Color | color, | ||
| Surface | surface | ||
| ) |
Adds a single vertex to the generated model, returning its vertex index.
| position | Vertex position |
| texCoords | Vertex texture coordinates |
| normal | Vertex normal |
| color | Vertex color |
| surface | Vertex surface info, used for texturing |
| void Chunks.Graphics.ModelGenerator.Clear | ( | ) |
Removes all vertex data and face indices from the generated model.
| bool Chunks.Graphics.ModelGenerator.HasIndices => _indices.Count > 0 |
Returns true if the model currently has any face indices.
|
getset |
|
getset |
1.8.10