Nebula
Loading...
Searching...
No Matches
raytracingcontext.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
12#include "coregraphics/buffer.h"
13#include "system_shaders/cluster_generate.h"
14#include "materials/materialtemplates.h"
16
17namespace Raytracing
18{
19
24
32
38
40{
42public:
47
49 static void Create(const RaytracingSetupSettings& settings);
50
54 static void SetupMesh(
56 , const UpdateType objectType
58 , const CoreGraphics::IndexType::Code indexType
59 , const CoreGraphics::VertexAlloc& vertices
60 , const CoreGraphics::VertexAlloc& indices
61 , const CoreGraphics::PrimitiveGroup& patchPrimGroup
62 , const SizeT vertexOffsetStride
63 , const SizeT patchVertexStride
64 , const Util::Array<Math::mat4> transforms
65 , const uint materialTableOffset
66 , const MaterialTemplates::MaterialProperties shader
67 , const CoreGraphics::VertexLayoutType vertexLayout
68 );
70 static void InvalidateBLAS(const Graphics::GraphicsEntityId id);
71
75 static void UpdateTransforms(const Graphics::FrameContext& ctx);
77 static void WaitForJobs(const Graphics::FrameContext& ctx);
79 static void UpdateViewResources(const Ptr<Graphics::View>& view, const Graphics::FrameContext& ctx);
80
81#ifndef PUBLIC_DEBUG
83 static void OnRenderDebug(uint32_t flags);
84#endif
85
86private:
87
91 static void Dealloc(Graphics::ContextEntityId id);
92
93
94
95 enum
96 {
101 };
102 typedef Ids::IdAllocator<
105 uint,
109};
110
111//------------------------------------------------------------------------------
119} // namespace Raytracing
Code
index types enum
Definition indextype.h:22
Defines a group of primitives as a subset of a vertex buffer and index buffer plus the primitive topo...
Definition primitivegroup.h:20
Format
component format
Definition vertexcomponent.h:25
Definition graphicscontext.h:165
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Ids::Id32 Alloc()
Allocate an object.
Definition idallocator.h:45
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition raytracingcontext.h:40
static void InvalidateBLAS(const Graphics::GraphicsEntityId id)
Invalidate a BLAS (for example, when the mesh has morphed) associated with a graphics entity.
Definition raytracingcontext.cc:552
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition raytracingcontext.cc:757
@ Raytracing_Blases
Definition raytracingcontext.h:100
@ Raytracing_UpdateType
Definition raytracingcontext.h:98
@ Raytracing_Allocation
Definition raytracingcontext.h:97
@ Raytracing_NumStructures
Definition raytracingcontext.h:99
Ids::IdAllocator< Memory::RangeAllocation, Raytracing::UpdateType, uint, Util::FixedArray< CoreGraphics::BlasId > > RaytracingAllocator
Definition raytracingcontext.h:107
static void OnRenderDebug(uint32_t flags)
debug rendering
Definition raytracingcontext.cc:747
static RaytracingAllocator raytracingContextAllocator
Definition raytracingcontext.h:108
static void UpdateViewResources(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
Update view constants.
Definition raytracingcontext.cc:731
static void SetupMesh(const Graphics::GraphicsEntityId id, const UpdateType objectType, const CoreGraphics::VertexComponent::Format format, const CoreGraphics::IndexType::Code indexType, const CoreGraphics::VertexAlloc &vertices, const CoreGraphics::VertexAlloc &indices, const CoreGraphics::PrimitiveGroup &patchPrimGroup, const SizeT vertexOffsetStride, const SizeT patchVertexStride, const Util::Array< Math::mat4 > transforms, const uint materialTableOffset, const MaterialTemplates::MaterialProperties shader, const CoreGraphics::VertexLayoutType vertexLayout)
Setup a terrain system for ray tracing.
Definition raytracingcontext.cc:466
static void WaitForJobs(const Graphics::FrameContext &ctx)
Wait for jobs to finish.
Definition raytracingcontext.cc:717
RaytracingContext()
constructor
Definition raytracingcontext.cc:72
static void UpdateTransforms(const Graphics::FrameContext &ctx)
Update transforms.
Definition raytracingcontext.cc:621
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition raytracingcontext.h:115
static void SetupModel(const Graphics::GraphicsEntityId id, CoreGraphics::BlasInstanceFlags flags, uchar mask)
Setup a model entity for ray tracing, assumes model context registration.
Definition raytracingcontext.cc:364
~RaytracingContext()
destructor
Definition raytracingcontext.cc:81
static void Create(const RaytracingSetupSettings &settings)
Setup ray tracing context.
Definition raytracingcontext.cc:90
static void ReconstructTopLevelAcceleration(const Graphics::FrameContext &ctx)
Build top level acceleration.
Definition raytracingcontext.cc:563
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
BlasInstanceFlags
Definition accelerationstructure.h:57
VertexLayoutType
Definition vertexlayout.h:49
Context dealing with scene management for ray tracing.
Definition modelcontext.h:40
UpdateType
Definition raytracingcontext.h:34
@ Static
Definition raytracingcontext.h:36
@ Dynamic
Definition raytracingcontext.h:35
ObjectType
Definition raytracingcontext.h:26
@ GLTFObject
Definition raytracingcontext.h:29
@ ParticleObject
Definition raytracingcontext.h:30
@ BRDFObject
Definition raytracingcontext.h:27
@ BSDFObject
Definition raytracingcontext.h:28
Definition mesh.h:23
Definition graphicscontext.h:133
Definition graphicsserver.h:31
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
Describes a range allocated by the Memory::RangeAllocator.
Definition raytracingcontext.h:21
SizeT maxNumAllowedInstances
Definition raytracingcontext.h:22
unsigned char uchar
Definition types.h:33
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31