/***************************************************************************
 *                          Zanoza Modeler v3.x                            *
 *     This is unpublished proprietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                 Copyright (c) 2002-2023 Zanoza Software.                *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler 3.3 shaders common buffers declaration
 *--------------------------------------------------------------------------
 * @histroy: 12.09.2011. Created
 * @histroy: 21.01.2023. Remastered for buffers-only file. 
<[[
Version  = 2.0.0
Engine = 11
]]>
 */
#ifndef ANIM_PALETTE_SIZE
#define ANIM_PALETTE_SIZE           100
#define ANIM_MATRIX_PALETTE_SIZE    1024
#endif


//----------------------------------------------------------------------
// common set of globals constants:
//----------------------------------------------------------------------
// b0-b3        : world;
// b4-b7        : view matrix;
// b8-b11       : projection matrix;
// b12-b15      : world-view-projection matrix;
//----------------------------------------------------------------------
cbuffer TransformBuffer : register(b0)
{
  float4x4    g_mWorld;//         : register(b0);
  float4x4    g_mView;//          : register(b4);
  float4x4    g_mProj;//          : register(b8);
  float4x4    g_mWorldViewProj;// : register(b12);
};

cbuffer CommonShadingBuffer : register(b1)
{
  // Color #0 : ambient RGB, Alpha : motion blur;
  // Color #1 : diffuse RGB, Alpha : global opacity;
  // Color #2 : specular RGB, Alpha : specular strength;
  // Color #3 : emissive RGB, Alpha : emissive power;
  float4      g_colors[4];//      : register(b16);
  float4      g_viewport;//       : register(b20);   //{width, height, 1/width, 1/height}
  float4      g_viewPosition;//   : register(b21);   //.w is 1 on persp. views and -1 on non-persp.
  float4      g_lightDir;//       : register(b22);
  float4      g_ambientLight;//   : register(b23);
  float4      g_faders;//         : register(b24);   //[backface saturation, backface opacity, 0, 0]
  float4      g_colorBlend;//     : register(b25);   //[per-vert diff, global diff, per-vert emis, vert alpha usage;]
  float4      g_deform;//         : register(b26);   //[deform level VS, transform level, 0, deform level PS]
  float4      g_effectLevels;//   : register(b27);   //0|1 switch for [dust, scratch, dirt, burnt]
  float4      g_geomLevels;//     : register(b28);   //[point unroll size, line unroll width, flat-shade normal strength, 0]
  float4      g_alpha;//          : register(b29);   //[minlevel:testvalue, maxlevel, mapaffect, angular level]
};

//
// private shading buffer #b2 is declared in a shader file itself;
//

//
// animation palette: pairs of quaternions (dual quaternions) for up
// to 100 bones.
cbuffer AnimPalette : register(b3)
{
  float2x4    g_animQuat[ANIM_PALETTE_SIZE];// : register(b55);
};

//
// animation palette: 4x3 matrices for up to 1024 bones.
cbuffer AnimMatPalette : register(b4)
{
  //
  // animation palette of 4x3 matrices (up to 1024) with 3x3 block for rotation
  // and fourth column being the offset xyz.
  float3x4    g_animMat[ANIM_MATRIX_PALETTE_SIZE];// : register(c255 and further);
};
