Пример #1
0
 private static bool SetBrushMesh(Int32 brushNodeID, BrushMeshInstance brushMesh)
 {
     return(SetBrushMeshID(brushNodeID, brushMesh.brushMeshID));
 }
Пример #2
0
 /// <summary>Generates a brush on the native side and returns a <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> struct that contains a reference to it.</summary>
 /// <param name="localTransformation">The transformation of the brush relative to the tree root</param>
 /// <param name="brushMesh">A <see cref="RealtimeCSG.Foundation.BrushMeshInstance"/>, which is a reference to a <see cref="RealtimeCSG.Foundation.BrushMesh"/>.</param>
 /// <param name="operation">The <see cref="RealtimeCSG.Foundation.CSGOperationType"/> that needs to be performed with this <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>.</param>
 /// <param name="flags"><see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> specific flags</param>
 /// <returns>A new <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>. May be an invalid node if it failed to create it.</returns>
 public static CSGTreeBrush Create(Matrix4x4 localTransformation, BrushMeshInstance brushMesh = default(BrushMeshInstance), CSGOperationType operation = CSGOperationType.Additive, CSGTreeBrushFlags flags = CSGTreeBrushFlags.Default)
 {
     return(Create(0, localTransformation, brushMesh, operation, flags));
 }
Пример #3
0
 /// <summary>Generates a brush on the native side and returns a <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> struct that contains a reference to it.</summary>
 /// <param name="userID">A unique id to help identify this particular brush. For instance, this could be an InstanceID to a [UnityEngine.Object](https://docs.unity3d.com/ScriptReference/Object.html)</param>
 /// <param name="brushMesh">A <see cref="RealtimeCSG.Foundation.BrushMeshInstance"/>, which is a reference to a <see cref="RealtimeCSG.Foundation.BrushMesh"/>.</param>
 /// <param name="operation">The <see cref="RealtimeCSG.Foundation.CSGOperationType"/> that needs to be performed with this <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>.</param>
 /// <param name="flags"><see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> specific flags</param>
 /// <returns>A new <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>. May be an invalid node if it failed to create it.</returns>
 public static CSGTreeBrush Create(Int32 userID = 0, BrushMeshInstance brushMesh = default(BrushMeshInstance), CSGOperationType operation = CSGOperationType.Additive, CSGTreeBrushFlags flags = CSGTreeBrushFlags.Default)
 {
     return(Create(userID, default(Matrix4x4), brushMesh, operation, flags));
 }
Пример #4
0
        /// <summary>Generates a brush on the native side and returns a <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> struct that contains a reference to it.</summary>
        /// <param name="userID">A unique id to help identify this particular brush. For instance, this could be an InstanceID to a [UnityEngine.Object](https://docs.unity3d.com/ScriptReference/Object.html)</param>
        /// <param name="localTransformation">The transformation of the brush relative to the tree root</param>
        /// <param name="brushMesh">A <see cref="RealtimeCSG.Foundation.BrushMeshInstance"/>, which is a reference to a <see cref="RealtimeCSG.Foundation.BrushMesh"/>.</param>
        /// <param name="operation">The <see cref="RealtimeCSG.Foundation.CSGOperationType"/> that needs to be performed with this <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>.</param>
        /// <param name="flags"><see cref="RealtimeCSG.Foundation.CSGTreeBrush"/> specific flags</param>
        /// <returns>A new <see cref="RealtimeCSG.Foundation.CSGTreeBrush"/>. May be an invalid node if it failed to create it.</returns>
        public static CSGTreeBrush Create(Int32 userID, Matrix4x4 localTransformation, BrushMeshInstance brushMesh = default(BrushMeshInstance), CSGOperationType operation = CSGOperationType.Additive, CSGTreeBrushFlags flags = CSGTreeBrushFlags.Default)
        {
            int brushNodeID;

            if (GenerateBrush(userID, out brushNodeID))
            {
                if (localTransformation != default(Matrix4x4))
                {
                    SetNodeLocalTransformation(brushNodeID, ref localTransformation);
                }
                if (operation != CSGOperationType.Additive)
                {
                    SetBrushOperationType(brushNodeID, operation);
                }
                if (flags != CSGTreeBrushFlags.Default)
                {
                    SetBrushFlags(brushNodeID, flags);
                }
                if (brushMesh.Valid)
                {
                    SetBrushMesh(brushNodeID, brushMesh);
                }
            }
            else
            {
                brushNodeID = 0;
            }
            return(new CSGTreeBrush()
            {
                brushNodeID = brushNodeID
            });
        }