예제 #1
0
        public override void Update(Scene.UpdateContext context)
        {
            if (activeAnimation == null)
            {
                return;
            }

            // Update animation matrices
            var animationMatrices = new float[skeleton.AnimationTextureSize * 16];

            for (var i = 0; i < skeleton.AnimationTextureSize; i++)
            {
                // Default to identity matrices
                animationMatrices[i * 16]        = 1.0f;
                animationMatrices[(i * 16) + 5]  = 1.0f;
                animationMatrices[(i * 16) + 10] = 1.0f;
                animationMatrices[(i * 16) + 15] = 1.0f;
            }

            time += context.Timestep;
            animationMatrices = activeAnimation.GetAnimationMatricesAsArray(time, skeleton);

            // Update animation texture
            GL.BindTexture(TextureTarget.Texture2D, animationTexture);
            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba32f, 4, skeleton.AnimationTextureSize, 0, PixelFormat.Rgba, PixelType.Float, animationMatrices);
            GL.BindTexture(TextureTarget.Texture2D, 0);
        }
예제 #2
0
        public override void Update(Scene.UpdateContext context)
        {
            particleRenderer.Position = Transform.Translation;
            particleRenderer.Update(context.Timestep);

            LocalBoundingBox = particleRenderer.BoundingBox.Translate(-particleRenderer.Position);
        }
        public override void Update(Scene.UpdateContext context)
        {
            if (activeAnimation == null)
            {
                return;
            }

            animationController.Update(context.Timestep);

            for (var i = 0; i < skeletons.Length; i++)
            {
                var skeleton         = skeletons[i];
                var animationTexture = animationTextures[i];

                // Update animation matrices
                var animationMatrices = new float[skeleton.AnimationTextureSize * 16];
                for (var j = 0; j < skeleton.AnimationTextureSize; j++)
                {
                    // Default to identity matrices
                    animationMatrices[j * 16]        = 1.0f;
                    animationMatrices[(j * 16) + 5]  = 1.0f;
                    animationMatrices[(j * 16) + 10] = 1.0f;
                    animationMatrices[(j * 16) + 15] = 1.0f;
                }

                animationMatrices = activeAnimation.GetAnimationMatricesAsArray(animationController.Time, skeleton);

                // Update animation texture
                GL.BindTexture(TextureTarget.Texture2D, animationTexture);
                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba32f, 4, skeleton.AnimationTextureSize, 0, PixelFormat.Rgba, PixelType.Float, animationMatrices);
                GL.BindTexture(TextureTarget.Texture2D, 0);
            }
        }
 public override void Update(Scene.UpdateContext context)
 {
 }