[2.x] About custom_materialBuffer

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
rujialiu
Goblin
Posts: 296
Joined: Mon May 09, 2016 8:21 am
x 35

[2.x] About custom_materialBuffer

Post by rujialiu »

Hi!

In Structs_piece_vs_piece_ps.hlsl, The material is declared as follows:

Code: Select all

struct Material
{
...
    float4 emissive;        //emissive.w contains mNormalMapWeight.
    float4 reserved[3];

    uint4 indices0_3;
    uint4 indices4_7;

    @insertpiece( custom_materialBuffer )
};
However, the indices are commented out in OgreHlmsPbsDatablock.h, so my new members are added directly after "reserved". But the size in C++ side is still

Code: Select all

const size_t HlmsPbsDatablock::MaterialSizeInGpu          = 64 * 4 + NUM_PBSM_TEXTURE_TYPES * 2;
So I had to move @insertpiece thing BEFORE uint4 indices0_3 to make it work.

Is it intentional? Or we can simply remove indices0_3 and indices4_7 in the shader's struct and adjust MaterialSizeInGpu in C++ code?
Thanks!
Post Reply