Graphics Reference
In-Depth Information
12. Create a new structure for storing the cube face camera view projections.
// Represents the camera for a cube face
// Note: the View matrix includes the current position
// Matrix.Transpose(Matrix.Invert(View)).Column4==Position
public struct CubeFaceCamera
{
public Matrix View;
public Matrix Projection;
}
13. Add the following private and public member fields and constructors to the
DynamicCubeMap class:
// The cubic environment map texture array (6 slices)
Texture2D EnvMap;
// The RTV for all cube map faces (for single pass)
RenderTargetView EnvMapRTV;
// The DSV for all cube map faces (for single pass)
DepthStencilView EnvMapDSV;
// The TextureCube SRV for use by the mesh/renderer
public ShaderResourceView EnvMapSRV;
// The 'per cube map buffer' to be assigned to the geometry
// shader stage when rendering the cubemap. This will
// contain the 6 ViewProjection matrices for the cube map.
public Buffer PerEnvMapBuffer;
// The viewport based on Size x Size
ViewportF Viewport;
// The renderer instance using the cube map reflection
public RendererBase Reflector { get; set; }
// The cameras for each face of the cube
public CubeFaceCamera[] Cameras = new CubeFaceCamera[6];
// The cube map texture size (e.g. 256x256)
public int Size { get; private set; }
public DynamicCubeMap(int size = 256)
: base()
{ // Set the cube map resolution (e.g. 256 x 256)
Size = size;
}
 
Search WWH ::




Custom Search