Ejemplo n.º 1
0
        public bool BuildMesh(CFontMesh fontMesh, CRenderContext rc, bool flipV)
        {
            var number = (int)SDK_FTTextDrawContext_GetDrawCall(CoreObject);

            if (number <= 0)
            {
                return(false);
            }

            unsafe
            {
                var p = stackalloc CShaderResourceView.NativePointer[number];
                {
                    var ptr = SDK_FTTextDrawContext_BuildMesh(CoreObject, rc.CoreObject, p, flipV);
                    if (ptr.Pointer == IntPtr.Zero)
                    {
                        return(false);
                    }

                    mBuildMeshSource.UnsafeReInit(ptr);
                    if (false == fontMesh.Mesh.Init(rc, RName.GetRName(null), mBuildMeshSource /*, CFTShadingEnv.GetFTShadingEnv()*/))
                    {
                        return(false);
                    }
                }

                var senv = CEngine.Instance.PrebuildPassData.Font2DShadingEnvs;
                for (int i = 0; i < number; i++)
                {
                    fontMesh.Mesh.SetMaterialWithEffects(rc, (UInt32)i, mMaterialInst, mEffects, senv);
                }

                for (int i = 0; i < number; i++)
                {
                    var pass = fontMesh.Mesh.MtlMeshArray[i].GetPass((int)PrebuildPassIndex.PPI_Default);
                    pass.ShaderResources.SetUserControlTexture(mTextureBindInfo.PSBindPoint, true);
                    pass.ShaderResources.PSBindTexturePointer(mTextureBindInfo.PSBindPoint, p[i]);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public void BuildMesh2(CFontMesh fontMesh, CCommandList cmd, bool flipV)
        {
            var rc     = CEngine.Instance.RenderContext;
            var number = fontMesh.Mesh.MtlMeshArray.Length;

            unsafe
            {
                var p = stackalloc CShaderResourceView.NativePointer[number];
                {
                    var ptr = SDK_FTTextDrawContext_BuildMesh(CoreObject, rc.CoreObject, p, flipV);
                    mBuildMeshSource.UnsafeReInit(ptr);
                }
                for (int i = 0; i < number; i++)
                {
                    var pass = fontMesh.Mesh.MtlMeshArray[i].GetPass((int)PrebuildPassIndex.PPI_Default);

                    pass.ShaderResources.PSBindTexturePointer(mTextureBindInfo.PSBindPoint, p[i]);
                }
            }
        }