Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions trinity/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ set(_SOURCES
Eve/EveRootTransform.cpp
Eve/EveRootTransform.h
Eve/EveRootTransform_Blue.cpp
Eve/EveSceneView.cpp
Eve/EveSceneView.h
Eve/EveSpaceScene.cpp
Eve/EveSpaceScene.h
Eve/EveSpaceScene_Blue.cpp
Expand Down
58 changes: 58 additions & 0 deletions trinity/Eve/EveSceneView.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright © 2026 CCP ehf.

#include "StdAfx.h"
#include "EveSceneView.h"

namespace EveSceneView
{
Camera::Camera( const Matrix& view, const Matrix& projection, const TextureSize2D& renderSize, const Matrix& jitterMatrix, float mipLodBias, float upscalingAmount )
{
this->view = view;
this->projection = projection;
this->jitterMatrix = jitterMatrix;
this->renderSize = renderSize;
this->mipLodBias = mipLodBias;
this->upscalingAmount = upscalingAmount;

const Matrix jitteredProjection = projection * jitterMatrix;
const Matrix inverseView = Inverse( view );
const Vector3 position( inverseView._41, inverseView._42, inverseView._43 );

CTriViewport viewport;
viewport.width = renderSize.width;
viewport.height = renderSize.height;

this->frustum.DeriveFrustum( &this->view, &position, &jitteredProjection, viewport );
}

ViewInfo ViewInfo::Main( bool distortion )
{
ViewInfo view;
view.reason = TR2RENDERREASON_NORMAL;
view.cullMode = Tr2RenderContextEnum::CULLMODE_CW;
view.distortion = distortion;
view.sceneObjects = true;
view.temporal = true;
view.subsurfaceScattering = true;
view.gpuParticles = true;
view.lensflares = true;
return view;
}

ViewInfo ViewInfo::ReflectionFace( bool lensflares )
{
ViewInfo view;
view.reason = TR2RENDERREASON_REFLECTION;
// Faces are rendered into a left handed cubemap, so the caller inverts the cull mode
// and the scene must not override it
view.cullMode = Tr2RenderContextEnum::CULLMODE_NONE;
view.distortion = false;
view.sceneObjects = false;
// faces must not disturb the main view's history
view.temporal = false;
view.subsurfaceScattering = false;
view.gpuParticles = false;
view.lensflares = lensflares;
return view;
}
}
56 changes: 56 additions & 0 deletions trinity/Eve/EveSceneView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright © 2026 CCP ehf.

#pragma once

#include "TriFrustum.h"
#include "ITr2Renderable.h"
#include "Tr2GpuResourcePool.h"

namespace EveSceneView
{
// Where a view looks from. Constructor derives the frustum from the other fields, so build a
// new Camera rather than changing one.
struct Camera
{
Matrix view;
Matrix projection;
Matrix jitterMatrix;
TextureSize2D renderSize;
float mipLodBias = 0.0f;
float upscalingAmount = 1.0f;
// derived from the view, the jittered projection and renderSize, never from the bound viewport
TriFrustum frustum;

Camera( const Matrix& view, const Matrix& projection, const TextureSize2D& renderSize, const Matrix& jitterMatrix = IdentityMatrix(), float mipLodBias = 0.0f, float upscalingAmount = 1.0f );
};

// What the scene renders for a view. The scene reads these flags rather than deciding per
// call site what a kind of view gets. The flags are off by default and every factory sets
// every field, so a new field has to be decided for each kind of view.
struct ViewInfo
{
// Passed on to GetBatches, so renderables can filter themselves (e.g. ShouldReflect)
Tr2RenderReason reason = TR2RENDERREASON_NORMAL;
Tr2RenderContextEnum::CullMode cullMode = Tr2RenderContextEnum::CULLMODE_CW;
bool distortion = false;
// Gather the scene's objects, camera attachments, static particles and impostors.
// Otherwise only the reflectable renderables in the component registry are gathered.
bool sceneObjects = false;
// The view feeds the next frame: view history for reprojection, temporal volumetrics
// and lens flare occlusion queries
bool temporal = false;
bool subsurfaceScattering = false;
bool gpuParticles = false;
bool lensflares = false;

// Render the scene as a reflection probe sees it: damped reflection intensity,
// reflection background and the reflection shadow map
bool IsReflection() const
{
return reason == TR2RENDERREASON_REFLECTION;
}

static ViewInfo Main( bool distortion );
static ViewInfo ReflectionFace( bool lensflares );
};
}
Loading
Loading