public TerrainPlane(VisionContent vContent)
 {
     Effect = vContent.LoadPlainEffect("Effects/TerrainEffects");
     _loPlane = new PlanePrimitive<TerrainVertex>(
         Effect.GraphicsDevice,
         (x, y, w, h) => new TerrainVertex(
             new Vector3(x, 0, y),
             new Vector2(x/SquareSize, y/SquareSize),
             x/SquareSize),
         SquareSize, SquareSize, 5);
 }
Exemple #2
0
        public override void GenerateGeometry(string scenePath, List <PrimitiveBase> output)
        {
            PlanePrimitive plane = PlanePrimitive.Create();

            plane.position = Position;
            plane.scale    = Scale;
            plane.euler    = Euler;
            plane.material = shaders[0];

            output.Add(plane);
        }
Exemple #3
0
        // Token: 0x0600422B RID: 16939 RVA: 0x00150438 File Offset: 0x0014E838
        public override void GenerateColliderGeometry()
        {
            Mesh colliderMesh = base.GetColliderMesh();

            if (colliderMesh)
            {
                colliderMesh.Clear();
                PlanePrimitive.GenerateGeometry(colliderMesh, this.width, this.length, this.widthSegments, this.lengthSegments);
                base.RefreshMeshCollider();
            }
            base.GenerateColliderGeometry();
        }
Exemple #4
0
        // Token: 0x060041FB RID: 16891 RVA: 0x0014F824 File Offset: 0x0014DC24
        public void GenerateGeometry(float size)
        {
            MeshFilter component = base.GetComponent <MeshFilter>();

            if (component.sharedMesh == null)
            {
                component.sharedMesh = new Mesh();
            }
            Mesh sharedMesh = component.sharedMesh;

            base.GenerationTimeMS = PlanePrimitive.GenerateGeometry(sharedMesh, size, size, 1, 1);
            this.size             = size;
            this.flipNormals      = false;
        }
Exemple #5
0
        // Token: 0x06004229 RID: 16937 RVA: 0x001503A4 File Offset: 0x0014E7A4
        public void GenerateGeometry(float width, float length, int widthSegments, int lengthSegments)
        {
            MeshFilter component = base.GetComponent <MeshFilter>();

            if (component.sharedMesh == null)
            {
                component.sharedMesh = new Mesh();
            }
            Mesh sharedMesh = component.sharedMesh;

            base.GenerationTimeMS = PlanePrimitive.GenerateGeometry(sharedMesh, width, length, widthSegments, lengthSegments);
            this.width            = width;
            this.length           = length;
            this.widthSegments    = widthSegments;
            this.lengthSegments   = lengthSegments;
            this.flipNormals      = false;
        }
        public WaterSurface(
            GraphicsDevice graphicsDevice,
            InitInfo initInfo)
        {
            Effect = new VisionEffect(initInfo.Fx, graphicsDevice.SamplerStates.LinearClamp)
            {
                SunlightDirection = VisionContent.SunlightDirection - new Vector3(0, VisionContent.SunlightDirection.Y/2, 0)
            };

            _waveBumpMapVelocity0 = initInfo.waveBumpMapVelocity0;
            _waveBumpMapVelocity1 = initInfo.waveBumpMapVelocity1;
            _waveDispMapVelocity0 = initInfo.waveDispMapVelocity0;
            _waveDispMapVelocity1 = initInfo.waveDispMapVelocity1;

            _hiPolyPlane = generatePlane(graphicsDevice, initInfo.SquareSize, initInfo.dx, initInfo.dz,
                                         initInfo.texScale);

            _lakePlane = generatePlane(graphicsDevice, 1, initInfo.SquareSize*512, initInfo.SquareSize*512, initInfo.texScale*512);

            buildFx(initInfo);

            var targetWidth = graphicsDevice.BackBuffer.Width;
            var targetHeight = graphicsDevice.BackBuffer.Height;
            _reflectionTarget = RenderTarget2D.New(
                graphicsDevice,
                targetWidth,
                targetHeight*11/10, //compensate for displaced waves
                graphicsDevice.BackBuffer.Format);

            _reflectionCamera = new Camera(
                new Vector2(targetWidth, targetHeight),
                null,
                null,
                null,
                Vector3.Zero,
                Vector3.Up);

            Update(10);
        }
Exemple #7
0
 public override Mesh Build()
 {
     return(PlanePrimitive.Create(this));
 }