Esempio n. 1
0
        /// <summary>
        /// Bind the material, this will call BeginInstance on the backend
        /// It is up to the caller to call EndInstance
        /// </summary>
        /// <param name="backend"></param>
        /// <param name="world"></param>
        /// <param name="worldView"></param>
        /// <param name="itWorldView"></param>
        /// <param name="modelViewProjection"></param>
        public void BindPerObject(Backend backend, ref Matrix4 world, ref Matrix4 worldView, ref Matrix4 itWorld, ref Matrix4 modelViewProjection, SkeletalAnimation.SkeletonInstance skeleton)
        {
            backend.BindShaderVariable(Handles.ModelViewProjection, ref modelViewProjection);
            backend.BindShaderVariable(Handles.World, ref world);
            backend.BindShaderVariable(Handles.WorldView, ref worldView);
            backend.BindShaderVariable(Handles.ItWorld, ref itWorld);

            if (skeleton != null)
            {
                backend.BindShaderVariable(Handles.Bones, ref skeleton.FinalBoneTransforms);
            }
        }
Esempio n. 2
0
        public void BeginInstance(Backend backend, Camera camera, int renderStateId)
        {
            if (!Initialized)
            {
                Initialize(backend);
            }

            backend.BeginInstance(Shader.Handle, TextureHandles, samplers: Samplers, renderStateId: renderStateId);
            for (var i = 0; i < SamplerToTexture.Length; i++)
            {
                backend.BindShaderVariable(SamplerToTexture[i], i);
            }

            backend.BindShaderVariable(Handles.Time, backend.ElapsedTime);
            backend.BindShaderVariable(Handles.CameraPosition, ref camera.Position);
        }