// ---------------- shadow map ----------------------------------------------------------------------------------------------------------------------
        public static unsafe void EncodeShadowMapMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                                      int startIndex, int indexCount, byte flipCulling, float4 bias)
        {
#if DEBUG
            float4 cd = GetShadowDebugColor(mesh.DebugIndex() + startIndex);
#endif
            mesh.SetForSubmit(encoder, startIndex, indexCount);
            EncodeShadowMap(sys, encoder, ref sys->m_shadowMapShader, viewId, ref tx, flipCulling, bias
#if DEBUG
                            , cd
#endif
                            );
        }
        public static unsafe void EncodeShadowMapSkinnedMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                                             int startIndex, int indexCount, byte flipCulling, float4 bias, float4x4[] boneMatrices)
        {
#if DEBUG
            float4 cd = GetShadowDebugColor(mesh.DebugIndex() + startIndex);
#endif
            mesh.SetForSubmit(encoder, startIndex, indexCount);
            fixed(float4x4 *p = boneMatrices)
            {
                bgfx.encoder_set_uniform(encoder, sys->m_skinnedMeshShadowMapShader.m_uniformBoneMatrices, p, (ushort)boneMatrices.Length);
            }

            EncodeShadowMap(sys, encoder, ref sys->m_skinnedMeshShadowMapShader.m_shadowMapShader, viewId, ref tx, flipCulling, bias
#if DEBUG
                            , cd
#endif
                            );
        }
 // ---------------- simple, unlit, with mesh ----------------------------------------------------------------------------------------------------------------------
 public static unsafe void SubmitSimpleMeshDirect(RendererBGFXInstance *sys, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx, ref SimpleMaterialBGFX mat, int startIndex, int indexCount, byte flipCulling, uint depth)
 {
     bgfx.Encoder *encoder = bgfx.encoder_begin(false);
     EncodeSimpleMesh(sys, encoder, viewId, ref mesh, ref tx, ref mat, startIndex, indexCount, flipCulling, depth);
     bgfx.encoder_end(encoder);
 }
 public static unsafe void EncodeSimpleMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx, ref SimpleMaterialBGFX mat, int startIndex, int indexCount, byte flipCulling, uint depth)
 {
     mesh.SetForSubmit(encoder, startIndex, indexCount);
     EncodeSimple(sys, encoder, viewId, ref tx, ref mat, flipCulling, depth);
 }
 public static unsafe void EncodeLitMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                         ref LitMaterialBGFX mat, ref LightingBGFX lighting, ref float4x4 viewTx, int startIndex, int indexCount,
                                         byte flipCulling, ref LightingViewSpaceBGFX viewSpaceLightCache, uint depth)
 {
     mesh.SetForSubmit(encoder, startIndex, indexCount);
     EncodeLit(sys, encoder, ref sys->m_litShader, viewId, ref tx, ref mat, ref lighting, ref viewTx, flipCulling, ref viewSpaceLightCache, depth);
 }
        public static unsafe void EncodeLitSkinnedMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                                       ref LitMaterialBGFX mat, ref LightingBGFX lighting, ref float4x4 viewTx, int startIndex, int indexCount,
                                                       byte flipCulling, ref LightingViewSpaceBGFX viewSpaceLightCache, uint depth, float4x4[] boneMatrices)
        {
            mesh.SetForSubmit(encoder, startIndex, indexCount);
            fixed(float4x4 *p = boneMatrices)
            {
                bgfx.encoder_set_uniform(encoder, sys->m_litSkinnedMeshShader.m_uniformBoneMatrices, p, (ushort)boneMatrices.Length);
            }

            EncodeLit(sys, encoder, ref sys->m_litSkinnedMeshShader.m_litShader, viewId, ref tx, ref mat, ref lighting, ref viewTx, flipCulling, ref viewSpaceLightCache, depth);
        }
        // ---------------- simple, lit, with mesh ----------------------------------------------------------------------------------------------------------------------
        public unsafe static void SubmitLitMeshDirect(RendererBGFXInstance *sys, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                                      ref LitMaterialBGFX mat, ref LightingBGFX lighting,
                                                      ref float4x4 viewTx, int startIndex, int indexCount, byte flipCulling, uint depth)
        {
            bgfx.Encoder *        encoder = bgfx.encoder_begin(false);
            LightingViewSpaceBGFX vsLight = default;

            vsLight.cacheTag = -1;
            EncodeLitMesh(sys, encoder, viewId, ref mesh, ref tx, ref mat, ref lighting, ref viewTx, startIndex, indexCount, flipCulling, ref vsLight, depth);
            bgfx.encoder_end(encoder);
        }
 public static unsafe void EncodeZOnlyMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx, int startIndex, int indexCount, byte flipCulling)
 {
     mesh.SetForSubmit(encoder, startIndex, indexCount);
     EncodeZOnly(sys, encoder, viewId, ref tx, flipCulling);
 }
 // ---------------- z only --------------------------------------------------------------------------------------------------------------------------
 public static unsafe void SubmitZOnlyMeshDirect(RendererBGFXInstance *sys, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx, int startIndex, int indexCount, byte flipCulling)
 {
     bgfx.Encoder *encoder = bgfx.encoder_begin(false);
     EncodeZOnlyMesh(sys, encoder, viewId, ref mesh, ref tx, startIndex, indexCount, flipCulling);
     bgfx.encoder_end(encoder);
 }
예제 #10
0
        public static unsafe void EncodeSimpleSkinnedmesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx, ref SimpleMaterialBGFX mat,
                                                          int startIndex, int indexCount, byte flipCulling, uint depth, float4x4[] boneMatrices)
        {
            mesh.SetForSubmit(encoder, startIndex, indexCount);
            fixed(float4x4 *p = boneMatrices)
            {
                bgfx.encoder_set_uniform(encoder, sys->m_simpleSkinnedMeshShader.m_uniformBoneMatrices, p, (ushort)boneMatrices.Length);
            }

            EncodeSimple(sys, encoder, ref sys->m_simpleSkinnedMeshShader.m_simpleShader, viewId, ref tx, ref mat, flipCulling, depth);
        }
예제 #11
0
 public static unsafe void EncodeShadowMapMesh(RendererBGFXInstance *sys, bgfx.Encoder *encoder, ushort viewId, ref MeshBGFX mesh, ref float4x4 tx,
                                               int startIndex, int indexCount, byte flipCulling, float4 bias)
 {
     mesh.SetForSubmit(encoder, startIndex, indexCount);
     EncodeShadowMap(sys, encoder, ref sys->m_shadowMapShader, viewId, ref tx, flipCulling, bias);
 }