Beispiel #1
0
        protected void RenderToColorMap(RenderTexture rt, ShaderUniqueParameter sp, Dictionary <Shader, Dictionary <Material, List <SubMeshData> > > sm)
        {
            // レンダーターゲットをセット
            rt.Bind(Color4.Black);

            colorShader.UseShader();
            colorShader.SetUniqueParameter(sp, true);

            ushort index = 0;

            foreach (var sh in sm)
            {
                foreach (var mat in sh.Value)
                {
                    foreach (var sub in mat.Value)
                    {
                        if (!sub.Visible)
                        {
                            continue;
                        }
                        sp.world = sub.WorldTransform;
                        colorShader.SetUniqueParameter(sp, false);
                        colorShader.SetParameter(colorShader.loc_color, ref randColors[index++]);

                        if (sub.Animator != null)
                        {
                            sub.Animator.BindMotion(1);
                        }
                        else
                        {
                            Animator.BindIdentity(1);
                        }
                        Drawer.DrawSubMesh(sub.SubMesh);
                        if (sub.Animator != null)
                        {
                            sub.Animator.UnbindMotion(1);
                        }
                        else
                        {
                            Animator.UnbindIdentity(1);
                        }
                    }
                }
            }
        }