示例#1
0
 public TerrainPaintBrushCatalogResource(uint version,
                                         uint brushVersion,
                                         Common common,
                                         BrushOperation normalOperation, BrushOperation oppositeOperation, TGIBlock profileTexture,
                                         BrushOrientation orientation,
                                         float width, float strength, byte baseTextureValue, float wiggleAmount,
                                         TGIBlock brushTexture,
                                         TerrainType terrain, CategoryType category)
     : base(version,
            brushVersion,
            common,
            normalOperation,
            oppositeOperation,
            profileTexture,
            orientation,
            width,
            strength,
            baseTextureValue,
            wiggleAmount
            )
 {
     this.brushTexture = (TGIBlock)brushTexture.Clone(OnResourceChanged);
     this.terrain      = terrain;
     this.category     = category;
 }
 public TerrainGeometryWaterBrushCatalogResource(int APIversion,
                                                 uint version,
                                                 uint brushVersion,
                                                 Common common,
                                                 BrushOperation normalOperation,
                                                 BrushOperation oppositeOperation,
                                                 TGIBlock profileTexture,
                                                 BrushOrientation orientation,
                                                 float width,
                                                 float strength,
                                                 byte baseTextureValue,
                                                 float wiggleAmount
                                                 )
     : base(APIversion, version, common)
 {
     this.brushVersion      = brushVersion;
     this.normalOperation   = normalOperation;
     this.oppositeOperation = oppositeOperation;
     this.profileTexture    = profileTexture;
     this.orientation       = orientation;
     this.width             = width;
     this.strength          = strength;
     this.baseTextureValue  = baseTextureValue;
     this.wiggleAmount      = wiggleAmount;
 }
 public TerrainGeometryWaterBrushCatalogResource(int APIversion,
     uint version,
     uint brushVersion,
     Common common,
     BrushOperation normalOperation,
     BrushOperation oppositeOperation,
     TGIBlock profileTexture,
     BrushOrientation orientation,
     float width,
     float strength,
     byte baseTextureValue,
     float wiggleAmount
     )
     : base(APIversion, version, common)
 {
     this.brushVersion = brushVersion;
     this.normalOperation = normalOperation;
     this.oppositeOperation = oppositeOperation;
     this.profileTexture = profileTexture;
     this.orientation = orientation;
     this.width = width;
     this.strength = strength;
     this.baseTextureValue = baseTextureValue;
     this.wiggleAmount = wiggleAmount;
 }
示例#4
0
 public TerrainPaintBrushCatalogResource(uint version,
                                         uint brushVersion,
                                         Common common,
                                         BrushOperation normalOperation, BrushOperation oppositeOperation, TGIBlock profileTexture,
                                         BrushOrientation orientation,
                                         float width, float strength, byte baseTextureValue, float wiggleAmount,
                                         TGIBlock brushTexture)
     : this(version,
            brushVersion,
            common,
            normalOperation,
            oppositeOperation,
            profileTexture,
            orientation,
            width,
            strength,
            baseTextureValue,
            wiggleAmount,
            brushTexture,
            0, 0
            )
 {
     if (version >= 0x00000004)
     {
         throw new InvalidOperationException(String.Format("Constructor requires terrain and category for version {0}", version));
     }
 }
 public TerrainPaintBrushCatalogResource(int APIversion,
     uint version,
     uint brushVersion,
     Common common,
     BrushOperation normalOperation, BrushOperation oppositeOperation, TGIBlock profileTexture, BrushOrientation orientation,
     float width, float strength, byte baseTextureValue, float wiggleAmount,
     TGIBlock brushTexture,
     TerrainType terrain, CategoryType category
     )
     : base(APIversion,
         version,
         brushVersion,
         common,
         normalOperation,
         oppositeOperation,
         profileTexture,
         orientation,
         width,
         strength,
         baseTextureValue,
         wiggleAmount
     )
 {
     this.brushTexture = (TGIBlock)brushTexture.Clone(OnResourceChanged);
     this.terrain = terrain;
     this.category = category;
 }
 public TerrainPaintBrushCatalogResource(int APIversion,
     uint version,
     uint brushVersion,
     Common common,
     BrushOperation normalOperation, BrushOperation oppositeOperation, TGIBlock profileTexture, BrushOrientation orientation,
     float width, float strength, byte baseTextureValue, float wiggleAmount,
     TGIBlock brushTexture
     )
     : this(APIversion,
         version,
         brushVersion,
         common,
         normalOperation,
         oppositeOperation,
         profileTexture,
         orientation,
         width,
         strength,
         baseTextureValue,
         wiggleAmount,
         brushTexture,
         0, 0
     )
 {
     if (checking) if (version >= 0x00000004)
             throw new InvalidOperationException(String.Format("Constructor requires terrain and category for version {0}", version));
 }
 internal CustomBrushPrimitive(TBrushType type, BrushOperation operation, float blend, float4x4 transform)
 {
     this.type         = type;
     this.operation    = operation;
     this.blend        = blend;
     this.transform    = transform;
     this.invTransform = math.inverse(transform);
 }
示例#8
0
        private void DeformTerrain(BrushOperation operation)
        {
            var brush = new SphereBrush {
                origin = hitPoint,
                radius = radius,
            };

            terrain.DeformTerrain(brush, operation);
        }
 protected override void Parse(Stream s)
 {
     base.Parse(s);
     BinaryReader r = new BinaryReader(s);
     this.brushVersion = r.ReadUInt32();
     common = new Common(requestedApiVersion, OnResourceChanged, s);
     this.normalOperation = (BrushOperation)r.ReadUInt32();
     this.oppositeOperation = (BrushOperation)r.ReadUInt32();
     this.profileTexture = new TGIBlock(requestedApiVersion, OnResourceChanged, s);
     this.orientation = (BrushOrientation)r.ReadUInt32();
     this.width = r.ReadSingle();
     this.strength = r.ReadSingle();
     this.baseTextureValue = r.ReadByte();
     this.wiggleAmount = r.ReadSingle();
 }
        protected override void Parse(Stream s)
        {
            base.Parse(s);
            BinaryReader r = new BinaryReader(s);

            this.brushVersion      = r.ReadUInt32();
            common                 = new Common(requestedApiVersion, OnResourceChanged, s);
            this.normalOperation   = (BrushOperation)r.ReadUInt32();
            this.oppositeOperation = (BrushOperation)r.ReadUInt32();
            this.profileTexture    = new TGIBlock(requestedApiVersion, OnResourceChanged, s);
            this.orientation       = (BrushOrientation)r.ReadUInt32();
            this.width             = r.ReadSingle();
            this.strength          = r.ReadSingle();
            this.baseTextureValue  = r.ReadByte();
            this.wiggleAmount      = r.ReadSingle();
        }
示例#11
0
        public void DeformTerrain(IBrush brush, BrushOperation operation)
        {
            var bounds = brush.GetBounds();

            var minIndex = (int3)math.floor(bounds.min / (TerrainChunk.CHUNK_SIZE * voxelSize));
            var maxIndex = (int3)math.floor(bounds.max / (TerrainChunk.CHUNK_SIZE * voxelSize));

            for (var x = minIndex.x; x <= maxIndex.x; x++)
            {
                for (var y = minIndex.y; y <= maxIndex.y; y++)
                {
                    for (var z = minIndex.z; z <= maxIndex.z; z++)
                    {
                        var chunk = GetOrCreateChunkByKey(new ChunkKey {
                            origin = math.int3(x, y, z)
                        });

                        chunk.ScheduleApplyBrushJob(brush, operation);
                    }
                }
            }
        }
示例#12
0
 /// <summary>
 /// Adds a brush primitive
 /// </summary>
 /// <param name="type">Type of the brush</param>
 /// <param name="operation">CSG operation of the brush</param>
 /// <param name="blend">Smooth blend distance in voxel units</param>
 /// <param name="transform">Transform to be applied to the brush primitive</param>
 public void AddPrimitive(TBrushType type, BrushOperation operation, float blend, float4x4 transform)
 {
     Primitives.Add(new CustomBrushPrimitive <TBrushType>(type, operation, blend, transform));
 }