Esempio n. 1
0
        public GrassRendrer(Form1 F)
            : base(F.Device)
        {
            this.P = F;
            this.CallFrequency = STDCallFrequencys.Always;
            E3 = new EffectWrapper("Grass_Mesh.fx", D);
            BlendStateDescription bsd = new BlendStateDescription()
            {
                AlphaToCoverageEnable = true,
                IndependentBlendEnable = false,
            };
            RenderTargetBlendDescription rtbd = new RenderTargetBlendDescription()
            {
                BlendEnable = true,
                BlendOperation = BlendOperation.Add,
                BlendOperationAlpha = BlendOperation.Add,
                RenderTargetWriteMask = ColorWriteMaskFlags.All,
                DestinationBlend = BlendOption.InverseSourceAlpha,
                SourceBlend = BlendOption.SourceAlpha,
                SourceBlendAlpha = BlendOption.Zero,
                DestinationBlendAlpha = BlendOption.One
            };
            bsd.RenderTargets[0] = rtbd;
            bsd0 = BlendState.FromDescription(D.HadrwareDevice(), bsd);

            StaticVertex[] vs = new StaticVertex[100];
            mBuffer = new DynamicMeshBuffer<StaticVertex>(D, PrimitiveTopology.PointList);
            mBuffer.Write(vs);
        }
Esempio n. 2
0
 public NodeDisplayerPostProc(Form1 P)
 {
     LineDrawer = new EffectWrapper("Line.fx", P.Device);
     this.P = P;
     short[] indices = new short[] {
         0, 1, 0, 2, 0, 3, 1, 4, 1, 6, 2, 4, 2, 5, 3, 5,
         3, 6, 4, 7, 5, 7, 6, 7
      };
     BoundingBox boundingBox = new BoundingBox(new Vector3(-1.0f), new Vector3(+1.0f));
     StaticVertex[] vertices = new StaticVertex[8];
     vertices[0].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Minimum.Y, boundingBox.Minimum.Z, 1f);
     vertices[1].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Minimum.Y, boundingBox.Maximum.Z, 1f);
     vertices[2].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Maximum.Y, boundingBox.Minimum.Z, 1f);
     vertices[3].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Minimum.Y, boundingBox.Minimum.Z, 1f);
     vertices[4].Position = new Vector4(boundingBox.Minimum.X, boundingBox.Maximum.Y, boundingBox.Maximum.Z, 1f);
     vertices[5].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Maximum.Y, boundingBox.Minimum.Z, 1f);
     vertices[6].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Minimum.Y, boundingBox.Maximum.Z, 1f);
     vertices[7].Position = new Vector4(boundingBox.Maximum.X, boundingBox.Maximum.Y, boundingBox.Maximum.Z, 1f);
     mBuffer = new MeshBuffer(vertices, indices, SlimDX.DXGI.Format.R16_UInt, vertices[0], P.Device, SlimDX.Direct3D11.PrimitiveTopology.LineList, SlimDX.Direct3D11.CpuAccessFlags.Write);
 }