Created
June 6, 2011 17:30
-
-
Save aras-p/1010683 to your computer and use it in GitHub Desktop.
UNITY_MATRIX_MVP et al equivalents in script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// world, view, projection matrices | |
var world = obj.transform.localToWorldMatrix; | |
var view = cam.worldToCameraMatrix; | |
var proj = cam.projectionMatrix; | |
// the actual projection matrix used in shaders | |
// is actually massaged a bit to work across all platforms | |
// (different Z value ranges etc.) | |
var gpuProj = GL.GetGPUProjectionMatrix (proj, false); | |
var gpuMV = view * world; // UNITY_MATRIX_MV | |
var gpuMVP = gpuProj * view * world; // UNITY_MATRIX_MVP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment