示例#1
0
        public void Render(IEffect effect)
        {
            effect.SetTexture("tex0", _noTexture);
            effect.CommitChanges();

            _vertexRenderer.RenderForShader(PrimitiveType.LineList, 0, 3);
        }
示例#2
0
        public void Render(ModelInstance modelInstance, IEffect effect)
        {
            foreach (var meshInstance in modelInstance.MeshInstances)
            {
                var renderer = GetRendererFor(meshInstance);

                var dataStream = renderer.LockVertexBuffer();
                dataStream.WriteRange(meshInstance.VertexBuffer);
                renderer.UnlockVertexBuffer();

                if (meshInstance.TextureArea == null)
                {
                    meshInstance.TextureArea = _graphicsContext.GetTexture(meshInstance.TextureName);
                }

                if (meshInstance.TextureName != _lastTextureName)
                {
                    _lastTextureName = meshInstance.TextureName;

                    effect.SetTexture("tex0", meshInstance.TextureArea);
                    effect.CommitChanges();
                }

                renderer.RenderForShader(PrimitiveType.TriangleList, 0, meshInstance.TriangleCount);
            }
        }