コード例 #1
0
        public virtual void Recompute(float t)
        {
            var p = position.Evaluate(t);
            var s = scale.Evaluate(t);
            var q = orientation.Evaluate(t);

            WorldMatrix = mat4.Translate(p) * q.ToMat4 * mat4.Scale(s);
        }
コード例 #2
0
ファイル: Sprite3D.cs プロジェクト: Grimelios/LudumDare46
        public void Recompute(float t)
        {
            colorField.Evaluate(t);

            var p = positionField.Evaluate(t);
            var s = scaleField.Evaluate(t);
            var q = orientationField.Evaluate(t);

            // By shifting the world matrix using the origin, all sprites using the same source rect and alignment
            // (regardless of transform) can be rendered using the same quad in GPU memory. This is most applicable to
            // 3D sprites that don't use a source rect at all (since they can all use the same unit square).
            var v = new vec3(correction / PixelDivisor, 0);

            WorldMatrix = mat4.Translate(p) * q.ToMat4 * mat4.Translate(v) * mat4.Scale(new vec3(s, 0));
        }