Sha256: c961ada7fc9100c963336fa12696a03bbe69e6847aca685273cd7d2b3748de0e
Contents?: true
Size: 1.49 KB
Versions: 12
Compression:
Stored size: 1.49 KB
Contents
/** * Transforms a position from model to window coordinates. The transformation * from model to clip coordinates is done using {@link czm_modelViewProjection}. * The transform from normalized device coordinates to window coordinates is * done using {@link czm_viewportTransformation}, which assumes a depth range * of <code>near = 0</code> and <code>far = 1</code>. * <br /><br /> * This transform is useful when there is a need to manipulate window coordinates * in a vertex shader as done by {@link BillboardCollection}. * <br /><br /> * This function should not be confused with {@link czm_viewportOrthographic}, * which is an orthographic projection matrix that transforms from window * coordinates to clip coordinates. * * @name czm_modelToWindowCoordinates * @glslFunction * * @param {vec4} position The position in model coordinates to transform. * * @returns {vec4} The transformed position in window coordinates. * * @see czm_eyeToWindowCoordinates * @see czm_modelViewProjection * @see czm_viewportTransformation * @see czm_viewportOrthographic * @see BillboardCollection * * @example * vec4 positionWC = czm_modelToWindowCoordinates(positionMC); */ vec4 czm_modelToWindowCoordinates(vec4 position) { vec4 q = czm_modelViewProjection * position; // clip coordinates q.xyz /= q.w; // normalized device coordinates q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates return q; }
Version data entries
12 entries across 12 versions & 1 rubygems