⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 phongtexturebumpvertexshader.cg

📁 基于java的3d开发库。对坐java3d的朋友有很大的帮助。
💻 CG
字号:
//===========================================================================
//= This vertex shader follows the parameters indicated in the VitralSDK    =
//= shader programming guidelines, as documented in the file                =
//= ./doc/shaderStandards.txt inside the main VitralSDK distribution        =
//= directory.  Please refer to that file to get a clear understanding of   =
//= variable names and common programming patterns used.                    =
//= Note that any variable name or registry assigment change could make the =
//= shader incompatible with main VitralSDK shader framework!               =
//===========================================================================

void main(uniform float4x4 modelViewProjectionLocal,
          uniform float4x4 modelViewLocal,
          uniform float4x4 modelViewLocalIT,
          uniform float4x4 modelViewGlobal,
          uniform float3 cameraPositionGlobal,
          uniform float3 lightPositionGlobal,
          in float4 PObject                   : POSITION,
          in float3 NObject                   : NORMAL,
          in float2 uvVertexTextureCoordinate : TEXCOORD0,
          in float3 ambientColor              : TEXCOORD1,
          in float3 diffuseColor              : TEXCOORD2,
          in float3 specularColor             : TEXCOORD3,
          in float3 TObject                   : TEXCOORD4,
          in float3 BObject                   : TEXCOORD5,
          out float4 projectedVertexPosition  : POSITION,
          out float3 PView                    : TEXCOORD0,
          out float3 NView                    : TEXCOORD1,
          out float2 uvTextureCoordinate      : TEXCOORD2,
          out float3 cameraPositionView       : TEXCOORD3,
          out float3 lightPositionView        : TEXCOORD4,
          out float3 Ka                       : TEXCOORD5,
          out float3 Kd                       : COLOR0,
          out float3 Ks                       : COLOR1,
          out float3 TView                    : TEXCOORD6,
          out float3 BView                    : TEXCOORD7)
{
    // Compute homogeneous position of vertex for rasterizer
    projectedVertexPosition = mul(modelViewProjectionLocal, PObject);

    // Transform positions and normals from model-space to view-space
    PView = mul(modelViewLocal, PObject).xyz;
    NView = mul(modelViewLocalIT, float4(NObject, 0)).xyz;
    TView = mul(modelViewLocalIT, float4(TObject, 0)).xyz;
    BView = mul(modelViewLocalIT, float4(BObject, 0)).xyz;

    cameraPositionView =
        mul(modelViewGlobal, float4(cameraPositionGlobal, 1)).xyz;
    lightPositionView =
        mul(modelViewGlobal, float4(lightPositionGlobal, 1)).xyz;
    uvTextureCoordinate = uvVertexTextureCoordinate;
    Ka = ambientColor;
    Kd = diffuseColor;
    Ks = specularColor;
}

//===========================================================================
//= EOF                                                                     =
//===========================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -