phong.vrt

来自「G3D游戏引擎的库」· VRT 代码 · 共 20 行

VRT
20
字号
/**
 Per-pixel Phong Shading
 */

/** Camera origin in world space */
uniform vec3 wsEyePosition;

/** Non-unit vector to the eye from the vertex */
varying vec3 wsInterpolatedEye;

/** Non-unit surface normal in world space */
varying vec3 wsInterpolatedNormal;

void main(void) {
    wsInterpolatedNormal = g3d_ObjectToWorldNormalMatrix * gl_Normal;
    wsInterpolatedEye    = wsEyePosition - (g3d_ObjectToWorldMatrix * gl_Vertex).xyz;

    gl_Position = ftransform();
}

⌨️ 快捷键说明

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