Beispiel #1
0
        public void Draw(IRenderer r, Node n)
        {
            CreateBuffers();
            Material mq = Material.CreateSimpleMaterial(Root.Instance.ResourceManager.LoadTexture("revenant.tga"));

            mq.twosided = true;
            mq.wire     = true;
            r.SetMode(RenderMode.Draw3D);
            r.SetMaterial(mq);
            IEffect e = (IEffect)Root.Instance.ResourceManager.Load("shaders/simple.cgfx", typeof(IEffect));

            float[] modelview  = new float[16];
            float[] projection = new float[16];
            r.GetMatrix(modelview, projection);
            Matrix4 m1 = Matrix4Extensions.FromFloats(modelview);
            Matrix4 m2 = Matrix4Extensions.FromFloats(projection);
            Matrix4 m3 = m2 * m1;

            e.SetParameter(e.GetParameter("mvp"), Matrix4Extensions.ToFloats(m3));
            e.SetParameter(e.GetParameter("mv"), modelview);
            e.SetParameter(e.GetParameter("Color"), new float[] { 1, 0, 0, 1 });
            e.BeginPass(0);
            foreach (Md5Mesh m in Meshes)
            {
                m.Draw(r, n);
            }
            e.EndPass(0);
        }
        public void SetDuration(int effectBlockIndex, long loopCount)
        {
            IEffect    effect    = _effects.GetEffect(effectBlockIndex);
            SET_EFFECT setEffect = (SET_EFFECT)effect.GetParameter("SET_EFFECT");

            if (loopCount == _reportDescriptorProperties.MAX_LOOP)
            {
                ENVELOPE envelope = (ENVELOPE)effect.GetParameter("ENVELOPE");

                setEffect.duration = _reportDescriptorProperties.DURATION_INFINITE;
                envelope.fadeTime  = 0d;
            }
            else
            {
                setEffect.duration *= loopCount;
            }
        }