コード例 #1
0
ファイル: Main.cs プロジェクト: ehalferty/ICBINGTKR
        public static void Main(string[] args)
        {
            var t = new Texture("bespin/basic");
            var g = new HollowBoxGenerator( new IntVec3(0, 0, 0), new IntVec3(1024, 1024, 1024), 4,  t);
            var worldspawn = new WorldspawnEntity(g.Brushes);

            worldspawn.AddAttribute("ambient", "300");
            worldspawn.AddAttribute("_color", (new Q3Color(0.7f, 0.6f, 0.6f)).ToString());

            Map testMap = new Map("generation", worldspawn);

            // Test backward brush direction.
            worldspawn.AddBrushes(new RightHexahedralBrushGenerator(new IntVec3(100, 100, 100), new IntVec3(90, 200, 200)).Brushes);

            // Test custom-shaped brushes for trisoup generator.
            List<Brush> brushes = new List<Brush> {
                new Brush(new List<BrushFace> {
                    new BrushFace(new IntVec3(64, 128, -368), new IntVec3(0, 128, -368), new IntVec3(0, 128, -432), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(64, 528, -508), new IntVec3(0, 528, -508), new IntVec3(0, -496, -508), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(0, -512, -384), new IntVec3(0, 512, -384), new IntVec3(64, 512, -384), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(0, 64, -368), new IntVec3(64, 64, -368), new IntVec3(64, 64, -432), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(64, -512, -384), new IntVec3(64, 512, -384), new IntVec3(64, 512, -448), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(0, 512, -384), new IntVec3(0, -512, -384), new IntVec3(0, 512, -448), new Texture("bespin/control02")),
                    new BrushFace(new IntVec3(64, 128, -384), new IntVec3(64, 64, -448), new IntVec3(0, 64, -384), new Texture("bespin/control02")),
                })
            };

            worldspawn.AddBrushes(brushes);

            testMap.AddEntity(new LightEntity(new IntVec3(200, 0, 0), 2000, new Q3Color(1, 0, 0)));
            testMap.AddEntity(new LightEntity(new IntVec3(-200, 0, 0), 2000, new Q3Color(0, 0, 1)));
            testMap.AddEntity(new JAInfoPlayerDeathmatchEntity(new IntVec3(0, 0, 0)));

            WriteMap(testMap);
            CompileMap(testMap);
        }
コード例 #2
0
ファイル: MTypes.cs プロジェクト: ehalferty/ICBINGTKR
 public BrushFace(IntPlane plane, Texture texture)
 {
     this.plane = plane; this.texture = texture;
 }
コード例 #3
0
ファイル: MTypes.cs プロジェクト: ehalferty/ICBINGTKR
 public BrushFace(IntVec3 a, IntVec3 b, IntVec3 c, Texture texture)
     : this(new IntPlane(a, b, c), texture)
 {
 }
コード例 #4
0
ファイル: ATypes.cs プロジェクト: ehalferty/ICBINGTKR
        public HollowBoxGenerator(IntVec3 origin, IntVec3 dimensions, int wallThickness, Texture texture)
        {
            // Top
            {
                var veca = new IntVec3(
                    origin.x - (dimensions.x / 2),
                    origin.y - (dimensions.y / 2),
                    origin.z + (dimensions.z / 2) - wallThickness);
                var vecb = new IntVec3(
                    origin.x + (dimensions.x / 2),
                    origin.y + (dimensions.y / 2),
                    origin.z + (dimensions.z / 2));
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }

            // Bottom
            {
                var veca = new IntVec3(
                    origin.x - (dimensions.x / 2),
                    origin.y - (dimensions.y / 2),
                    origin.z - (dimensions.z / 2));
                var vecb = new IntVec3(
                    origin.x + (dimensions.x / 2),
                    origin.y + (dimensions.y / 2),
                    origin.z - (dimensions.z / 2) + wallThickness);
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }

            // Side +x
            {
                var veca = new IntVec3(
                    origin.x + (dimensions.x / 2) - wallThickness,
                    origin.y - (dimensions.y / 2),
                    origin.z - (dimensions.z / 2));
                var vecb = new IntVec3(
                    origin.x + (dimensions.x / 2),
                    origin.y + (dimensions.y / 2),
                    origin.z + (dimensions.z / 2));
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }

            // Side -x
            {
                var veca = new IntVec3(
                    origin.x - (dimensions.x / 2),
                    origin.y - (dimensions.y / 2),
                    origin.z - (dimensions.z / 2));
                var vecb = new IntVec3(
                    origin.x - (dimensions.x / 2) + wallThickness,
                    origin.y + (dimensions.y / 2),
                    origin.z + (dimensions.z / 2));
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }

            // Side +y
            {
                var veca = new IntVec3(
                    origin.x - (dimensions.x / 2),
                    origin.y + (dimensions.y / 2) - wallThickness,
                    origin.z - (dimensions.z / 2));
                var vecb = new IntVec3(
                    origin.x + (dimensions.x / 2),
                    origin.y + (dimensions.y / 2),
                    origin.z + (dimensions.z / 2));
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }

            // Side -y
            {
                var veca = new IntVec3(
                    origin.x - (dimensions.x / 2),
                    origin.y - (dimensions.y / 2),
                    origin.z - (dimensions.z / 2));
                var vecb = new IntVec3(
                    origin.x + (dimensions.x / 2),
                    origin.y - (dimensions.y / 2) + wallThickness,
                    origin.z + (dimensions.z / 2));
                brushes.AddRange(new RightHexahedralBrushGenerator(veca, vecb, texture).Brushes);
            }
        }
コード例 #5
0
ファイル: ATypes.cs プロジェクト: ehalferty/ICBINGTKR
        public TriSoupBrushGenerator(IntVec3 veca, IntVec3 vecb, Texture texture)
        {
            this.spoint = veca;
            this.epoint = vecb;
            Utils.fixDirection(ref this.spoint, ref this.epoint);

            Brush b = new Brush();

            b.AddFace(new BrushFace(new IntPlane(this.spoint.x, 0, 0, this.spoint.x, 1, 0, this.spoint.x, 0, 1), texture));
            b.AddFace(new BrushFace(new IntPlane(this.epoint.x, 0, 0, this.epoint.x, 0, 1, this.epoint.x, 1, 0), texture));
            b.AddFace(new BrushFace(new IntPlane(0, this.spoint.y, 0, 0, this.spoint.y, 1, 1, this.spoint.y, 0), texture));
            b.AddFace(new BrushFace(new IntPlane(0, this.epoint.y, 0, 1, this.epoint.y, 0, 0, this.epoint.y, 1), texture));
            b.AddFace(new BrushFace(new IntPlane(0, 0, this.spoint.z, 1, 0, this.spoint.z, 0, 1, this.spoint.z), texture));
            b.AddFace(new BrushFace(new IntPlane(0, 0, this.epoint.z, 0, 1, this.epoint.z, 1, 0, this.epoint.z), texture));

            brushes.Add(b);
        }