ajon542 / GameEngine

Experimenting with OpenTK inside WPF
0 stars 0 forks source link

Create a default set of variables to be sent to the shaders #15

Closed ajon542 closed 8 years ago

ajon542 commented 8 years ago

Defaults could include modelToWorld, worldToView and viewToProjection matrices and basic shading parameters. There should most likely be an include shader file. Since GLSL doesn't support include files, we will likely have to read this file in prior to loading the shaders and prepend the result.

ajon542 commented 8 years ago

Some of the Unity default uniforms based on the wikibook located here: https://en.wikibooks.org/wiki/Cg_Programming/Unity/Shading_in_World_Space

uniform float4 _Time, _SinTime, _CosTime; // time values uniform float4 _ProjectionParams; // x = 1 or -1 (-1 if projection is flipped) // y = near plane; z = far plane; w = 1/far plane uniform float4 _ScreenParams; // x = width; y = height; z = 1 + 1/width; w = 1 + 1/height uniform float3 _WorldSpaceCameraPos; uniform float4x4 _Object2World; // model matrix uniform float4x4 _World2Object; // inverse model matrix uniform float4 _LightPositionRange; // xyz = pos, w = 1/range uniform float4 _WorldSpaceLightPos0; // position or direction of light source

uniform float4x4 UNITY_MATRIX_MVP; // model view projection matrix uniform float4x4 UNITY_MATRIX_MV; // model view matrix uniform float4x4 UNITY_MATRIX_V; // view matrix uniform float4x4 UNITY_MATRIX_P; // projection matrix uniform float4x4 UNITY_MATRIX_VP; // view projection matrix uniform float4x4 UNITY_MATRIX_T_MV; // transpose of model view matrix uniform float4x4 UNITY_MATRIX_IT_MV; // transpose of the inverse model view matrix uniform float4x4 UNITY_MATRIX_TEXTURE0; // texture matrix uniform float4x4 UNITY_MATRIX_TEXTURE1; // texture matrix uniform float4x4 UNITY_MATRIX_TEXTURE2; // texture matrix uniform float4x4 UNITY_MATRIX_TEXTURE3; // texture matrix uniform float4 UNITY_LIGHTMODEL_AMBIENT; // ambient color

ajon542 commented 8 years ago

This is done.