voxels
This commit is contained in:
parent
3613c03085
commit
6fe9c0f4c2
7 changed files with 262 additions and 13 deletions
|
|
@ -39,4 +39,31 @@ Camera::Camera(float fov, float aspectRatio, float near, float far) {
|
|||
void Camera::Update() {
|
||||
projectionView = projection*view;
|
||||
onUpdate.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
Vector<float, 3> Camera::ToRay(uint32_t x, uint32_t y) {
|
||||
// // Normalize the screen coordinates
|
||||
// float mx = (2.0f * x) / sizeX - 1.0f;
|
||||
// float my = 1.0f - (2.0f * y) / sizeY;
|
||||
//
|
||||
// // Construct Ray in Homogeneous Clip Space
|
||||
// Vector<float, 3> rayOrigin = Vector<float, 3>(mx, my, 0.0f);
|
||||
// Vector<float, 3> rayEnd = Vector<float, 3>(mx, my, 1.0f);
|
||||
//
|
||||
// // Transform Ray to View Space
|
||||
// MatrixRowMajor<float, 4, 4, 1> invProjection = DirectX::XMMatrixInverse(NULL, projectionMatrix);
|
||||
// Vector<float, 3> rayOriginView = DirectX::XMVector3TransformCoord(rayOrigin, invProjection);
|
||||
// Vector<float, 3> rayEndView = DirectX::XMVector3TransformCoord(rayEnd, invProjection);
|
||||
//
|
||||
// // Transform Ray to World Space
|
||||
// DirectX::XMMATRIX viewMatrix = GetViewMatrix(); // Assuming this returns the view matrix
|
||||
// DirectX::XMMATRIX invView = DirectX::XMMatrixInverse(NULL, viewMatrix);
|
||||
// Vector<float, 3> rayOriginWorld = DirectX::XMVector3TransformCoord(rayOriginView, invView);
|
||||
// Vector<float, 3> rayEndWorld = DirectX::XMVector3TransformCoord(rayEndView, invView);
|
||||
//
|
||||
// // Compute Ray Direction
|
||||
// DirectX::XMVECTOR rayDirWorld = DirectX::XMVector3Normalize(DirectX::XMVectorSubtract(rayEndWorld, rayOriginWorld));
|
||||
//
|
||||
// return rayDirWorld;
|
||||
return Vector<float, 3>(0,0,0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue