Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ==Proposal for CSG reoranisation==
- CSG is adding a lot of new code for generating certain primitives, for example
- CSGBox and CSGSphere. Most of those primitives (and more) already exist in the
- PrimitiveMesh class, which is used by MeshInstance and CSGMesh.
- My proposal thereby is:
- * Make CSGMesh the top CSG class like so:
- Object
- |-Node
- |-Spatial
- |-VirtualInstance
- |-CSGMesh
- * CSGMesh gets the following properties:
- => All properties of CSGShape
- -> Property of type "Mesh" for choosing a mesh or PrimitiveMesh
- -> Property of type "Mesh" that contains the merged mesh of itself
- and all its children
- * The CSGBox, CSGSphere, CSGCombiner, etc. classes are merely added as syntactic
- sugar. They are all direct children of CSGMesh.
- CSGBox inherits from CSGMesh and has its mesh set statically to CubeMesh.
- CSGSphere inherits from CSGMesh and has its mesh set statically to SphereMesh.
- ...
- CSGCombiner inherits from CSGMesh and has its mesh set statically to null.
- That way, the Mesh subclass PrimitiveMesh is reused for all shapes available in
- CSG, which increases code reuse and makes the structure more consistent.
Add Comment
Please, Sign In to add comment