/* =========================================================================== Copyright (C) 2024 Gian 'myT' Schellenbaum This file is part of Challenge Quake 3 (CNQ3). Challenge Quake 3 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Challenge Quake 3 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Challenge Quake 3. If not, see . =========================================================================== */ // shared structure for a given scene view #pragma once #include "typedefs.h.hlsli" #if defined(__cplusplus) # pragma pack(push, 4) #endif struct DynamicLight { float3 position; float radius; float3 color; float padding; }; #define SCENE_VIEW_MAX_LIGHTS 32 struct SceneView { matrix projectionMatrix; matrix invProjectionMatrix; matrix viewMatrix; matrix invViewMatrix; float4 clipPlane; float4 debug; uint sceneViewIndex; uint frameIndex; uint depthTextureIndex; uint normalTextureIndex; uint shadingPositionTextureIndex; uint lightTextureIndex; uint tlasBufferIndex; uint tlasInstanceBufferIndex; uint lightCount; DynamicLight lights[SCENE_VIEW_MAX_LIGHTS]; }; #if defined(__cplusplus) # pragma pack(pop) #endif #if defined(__cplusplus) static_assert(sizeof(DynamicLight) == 32, "sizeof(DynamicLight) is wrong"); #endif #if !defined(__cplusplus) SceneView GetSceneView() { StructuredBuffer sceneViewBuffer = ResourceDescriptorHeap[0]; SceneView sceneView = sceneViewBuffer[0]; return sceneView; } #endif