Beispiel #1
0
        public void Render(GameActorInstance gameActorInstance, Renderer2D renderer)
        {
            if (TextureIndex < 0 || RenderOpacity <= 0.0f)
            {
                return;
            }

            switch (BlendMode)
            {
            case Nima.BlendModes.Normal:
                renderer.BlendMode = Renderer2D.BlendModes.Transparent;
                break;

            case Nima.BlendModes.Additive:
                renderer.BlendMode = Renderer2D.BlendModes.Additive;
                break;

            case Nima.BlendModes.Multiply:
                renderer.BlendMode = Renderer2D.BlendModes.Multiply;
                break;

            case Nima.BlendModes.Screen:
                renderer.BlendMode = Renderer2D.BlendModes.Screen;
                break;
            }

            Texture texture = gameActorInstance.BaseGameActor.Textures[TextureIndex];

            IndexBuffer indexBuffer = gameActorInstance.BaseGameActor.IdxBuffer;

            if (m_DeformVertexBuffer != null && IsVertexDeformDirty)
            {
                m_DeformVertexBuffer.SetData(AnimationDeformedVertices);
                IsVertexDeformDirty = false;
            }

            if (ConnectedBoneCount > 0)
            {
                if (m_DeformVertexBuffer != null)
                {
                    renderer.DrawTexturedAndDeformedSkin(WorldTransform, m_DeformVertexBuffer, m_VertexBuffer, indexBuffer, m_IndexOffset, TriangleCount * 3, BoneInfluenceMatrices, RenderOpacity, Color.White, texture);
                }
                else
                {
                    renderer.DrawTexturedSkin(WorldTransform, m_VertexBuffer, indexBuffer, m_IndexOffset, TriangleCount * 3, BoneInfluenceMatrices, RenderOpacity, Color.White, texture);
                }
            }
            else
            {
                if (m_DeformVertexBuffer != null)
                {
                    renderer.DrawTexturedAndDeformed(WorldTransform, m_DeformVertexBuffer, m_VertexBuffer, indexBuffer, m_IndexOffset, TriangleCount * 3, RenderOpacity, Color.White, texture);
                }
                else
                {
                    renderer.DrawTextured(WorldTransform, m_VertexBuffer, indexBuffer, m_IndexOffset, TriangleCount * 3, RenderOpacity, Color.White, texture);
                }
            }
        }