You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.3 KiB
Plaintext
78 lines
2.3 KiB
Plaintext
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project.
|
|
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#ifndef AZ_COLLECTING_PARTIAL_SRGS
|
|
#error Do not include this file directly. Include the main .srgi file instead.
|
|
#endif
|
|
|
|
#include <Atom/Feature/Common/Assets/ShaderResourceGroups/SkyBox/SceneSrg.azsli>
|
|
#include <Atom/Feature/Common/Assets/ShaderResourceGroups/CoreLights/SceneSrg.azsli>
|
|
#include <Atom/Feature/Common/Assets/ShaderResourceGroups/PostProcessing/SceneSrg.azsli>
|
|
|
|
partial ShaderResourceGroup SceneSrg
|
|
{
|
|
|
|
struct ObjectToWorld
|
|
{
|
|
row_major float3x4 m_transform;
|
|
};
|
|
|
|
struct NormalToWorld
|
|
{
|
|
row_major float3x4 m_transform;
|
|
};
|
|
|
|
StructuredBuffer<ObjectToWorld> m_objectToWorldBuffer;
|
|
StructuredBuffer<NormalToWorld> m_objectToWorldInverseTransposeBuffer;
|
|
StructuredBuffer<ObjectToWorld> m_objectToWorldHistoryBuffer;
|
|
|
|
TextureCube m_specularEnvMap;
|
|
TextureCube m_diffuseEnvMap;
|
|
float4 m_iblOrientation;
|
|
float m_iblExposure;
|
|
|
|
Sampler m_samplerEnv
|
|
{
|
|
AddressU = Wrap;
|
|
AddressV = Wrap;
|
|
MinFilter = Linear;
|
|
MagFilter = Linear;
|
|
MipFilter = Linear;
|
|
};
|
|
|
|
float4x4 GetObjectToWorldMatrix(uint objectId)
|
|
{
|
|
return float4x4(
|
|
m_objectToWorldBuffer[objectId].m_transform[0],
|
|
m_objectToWorldBuffer[objectId].m_transform[1],
|
|
m_objectToWorldBuffer[objectId].m_transform[2],
|
|
float4(0, 0, 0, 1));
|
|
}
|
|
|
|
// Used for transforming normals, handles non-uniform scale correctly.
|
|
float3x3 GetObjectToWorldInverseTransposeMatrix(uint objectId)
|
|
{
|
|
return float3x3(
|
|
m_objectToWorldInverseTransposeBuffer[objectId].m_transform[0].xyz,
|
|
m_objectToWorldInverseTransposeBuffer[objectId].m_transform[1].xyz,
|
|
m_objectToWorldInverseTransposeBuffer[objectId].m_transform[2].xyz
|
|
);
|
|
}
|
|
|
|
float4x4 GetObjectToWorldMatrixPrev(uint objectId)
|
|
{
|
|
return float4x4(
|
|
m_objectToWorldHistoryBuffer[objectId].m_transform[0],
|
|
m_objectToWorldHistoryBuffer[objectId].m_transform[1],
|
|
m_objectToWorldHistoryBuffer[objectId].m_transform[2],
|
|
float4(0, 0, 0, 1));
|
|
}
|
|
}
|
|
|
|
|