GMODCSG is an attempt to use live CSG (constructible solid geometry) in GMOD
It still pretty buggy, as it's just a test.
Feel free to modify the code as you wish, giving credits to the original authors bellow:
Class.lua:
-Copyright 2012 Two Lives Left Pty. Ltd.
-Licensed under the Apache License, Version 2.0
-http://www.apache.org/licenses/LICENSE-2.0
CSG.JS:
-Copyright (c) 2011 Evan Wallace (http://madebyevan.com/)
-Licensed under the MIT license.
-https://opensource.org/licenses/mit-license.php
CSG.JS - LUA port by:
-Tobias Teleman
-https://github.com/tnlogy/csg.js
Testing the code:
*Copy the contents of this repository over your "lua" folder on your
GMOD installation directory.
*Start a new Sandbox Game.
*Opening the Tool Menu -> Entities -> Fun + Games -> CSG
*Put as many CSG cube on the scene as you wish
*Opening the context tool, you can right click a CSG brush and modify the properties:
-Pos - Brush Position
-Angles - Brush Rotation
-Size - Brush Size (bounds)
-SizeMultiplier - Brush Size Multiplier
-Additive - If this brush is a CSG addition or subtraction
*Also on the context menu, there is a button "Rebuild" on the CSG Window. Clicking it will build the actual mesh from CSG brushes
Known issues (most important ones):
*Depending on the complexicity of the CSG operators, GMOD may crash due to an excessive stack operation
*Internal subtraction intersected faces are flipped (seems easy to be fixed)
*CSG.JS normals are incorrect
*Brush sizes smaller or equal to 0 may crash GMOD
*CSG brush shadows must be disabled