Пример #1
0
        public override void Draw(BaseEffect effect)
        {
            if (this.device == null || this.primitiveCount <= 0 || (this.vertices == null || this.vertices.Length <= 0) || (this.indexBuffer == null || this.vertexBuffer == null || (this.Instances == null || this.InstanceCount <= 0)))
            {
                return;
            }
            IShaderInstantiatableEffect <InstanceType> instantiatableEffect = effect as IShaderInstantiatableEffect <InstanceType>;

            this.device.SetVertexBuffer(this.vertexBuffer);
            this.device.Indices = this.indexBuffer;
            int val1 = this.InstanceCount;

            while (val1 > 0)
            {
                int length      = Math.Min(val1, this.InstancesPerBatch);
                int sourceIndex = this.InstanceCount - val1;
                if (this.tempInstances == null || this.tempInstances.Length < length)
                {
                    this.tempInstances = new InstanceType[Math.Min((int)Math.Ceiling((double)length / (double)this.PredictiveBatchSize) * this.PredictiveBatchSize, this.InstancesPerBatch)];
                }
                Array.Copy((Array)this.Instances, sourceIndex, (Array)this.tempInstances, 0, length);
                instantiatableEffect.SetInstanceData(this.tempInstances);
                effect.Apply();
                this.device.DrawIndexedPrimitives(this.primitiveType, 0, 0, length * this.vertices.Length, 0, length * this.primitiveCount);
                val1 -= length;
            }
        }
Пример #2
0
 public override void Draw(BaseEffect effect)
 {
     if (this.device == null || this.vertices.Length <= 0 || this.Empty)
     {
         return;
     }
     effect.Apply();
     this.device.DrawUserIndexedPrimitives <T>(this.primitiveType, this.vertices, 0, this.vertices.Length, this.indices, 0, this.primitiveCount);
 }
 public override void Draw(BaseEffect effect)
 {
     if (this.device == null || this.primitiveCount <= 0 || (this.indexBuffer == null || this.vertexBuffer == null))
     {
         return;
     }
     this.device.SetVertexBuffer(this.vertexBuffer);
     this.device.Indices = this.indexBuffer;
     effect.Apply();
     this.device.DrawIndexedPrimitives(this.primitiveType, 0, 0, this.vertexCount, 0, this.primitiveCount);
 }