cnq3/code/renderer/shaders/crp/scene_view.h.hlsli
myT a76dba5cfb raytracing soft shadows, normal smoothing, G-buffer viz
- brightness-corrected ImGUI drawing
- upgraded shader code to HLSL 2021
- vertex normals drawing
2024-02-06 23:15:31 +01:00

78 lines
1.9 KiB
HLSL

/*
===========================================================================
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 <https://www.gnu.org/licenses/>.
===========================================================================
*/
// 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<SceneView> sceneViewBuffer = ResourceDescriptorHeap[0];
SceneView sceneView = sceneViewBuffer[0];
return sceneView;
}
#endif