- SlimDXについて語ろうぜ
124 :名前は開発中のものです。[sage]:2011/04/12(火) 16:22:02.28 ID:155qZFtN - >>123
実装を見て考えたら? Vector3 Vector3::Unproject( Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix worldViewProjection ) { Vector3 v; Matrix matrix; Matrix::Invert( worldViewProjection, matrix ); v.X = ( ( ( vector.X - x ) / width ) * 2.0f ) - 1.0f; v.Y = -( ( ( ( vector.Y - y ) / height ) * 2.0f ) - 1.0f ); v.Z = ( vector.Z - minZ ) / ( maxZ - minZ ); Vector3::TransformCoordinate( v, matrix, v ); return v; }
|
|