Guest User

Untitled

a guest
Jul 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. ==Proposal for CSG reoranisation==
  2.  
  3. CSG is adding a lot of new code for generating certain primitives, for example
  4. CSGBox and CSGSphere. Most of those primitives (and more) already exist in the
  5. PrimitiveMesh class, which is used by MeshInstance and CSGMesh.
  6.  
  7. My proposal thereby is:
  8.  
  9. * Make CSGMesh the top CSG class like so:
  10. Object
  11. |-Node
  12. |-Spatial
  13. |-VirtualInstance
  14. |-CSGMesh
  15.  
  16. * CSGMesh gets the following properties:
  17. => All properties of CSGShape
  18. -> Property of type "Mesh" for choosing a mesh or PrimitiveMesh
  19. -> Property of type "Mesh" that contains the merged mesh of itself
  20. and all its children
  21.  
  22. * The CSGBox, CSGSphere, CSGCombiner, etc. classes are merely added as syntactic
  23. sugar. They are all direct children of CSGMesh.
  24.  
  25. CSGBox inherits from CSGMesh and has its mesh set statically to CubeMesh.
  26. CSGSphere inherits from CSGMesh and has its mesh set statically to SphereMesh.
  27. ...
  28. CSGCombiner inherits from CSGMesh and has its mesh set statically to null.
  29.  
  30. That way, the Mesh subclass PrimitiveMesh is reused for all shapes available in
  31. CSG, which increases code reuse and makes the structure more consistent.
Add Comment
Please, Sign In to add comment