forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSky.h
More file actions
66 lines (59 loc) · 2.13 KB
/
Sky.h
File metadata and controls
66 lines (59 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <d3d11.h>
#include <wrl/client.h>
#include <memory>
#include "Mesh.h"
#include "SimpleShader.h"
#include "Camera.h"
#include "WICTextureLoader.h"
class Sky
{
public:
Sky(
Microsoft::WRL::ComPtr<ID3D11Device> device,
Microsoft::WRL::ComPtr<ID3D11DeviceContext> context,
std::shared_ptr<Mesh> skyGeometry,
std::shared_ptr<SimpleVertexShader> skyVS,
std::shared_ptr<SimplePixelShader> skyPS,
Microsoft::WRL::ComPtr<ID3D11SamplerState> skySampler,
const wchar_t* right,
const wchar_t* left,
const wchar_t* up,
const wchar_t* down,
const wchar_t* front,
const wchar_t* back
);
void Draw(Microsoft::WRL::ComPtr<ID3D11DeviceContext> context, std::shared_ptr<Camera> camera);
private:
std::shared_ptr<Mesh> skyGeometry;
std::shared_ptr<SimpleVertexShader> skyVS;
std::shared_ptr<SimplePixelShader> skyPS;
Microsoft::WRL::ComPtr<ID3D11SamplerState> skySampler;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> skySRV;
Microsoft::WRL::ComPtr<ID3D11DepthStencilState> skyDepthStencilState;
Microsoft::WRL::ComPtr<ID3D11RasterizerState> skyRasterizerState;
// --------------------------------------------------------
// Author: Chris Cascioli
// Purpose: Creates a cube map on the GPU from 6 individual textures
//
// - You are allowed to directly copy/paste this into your code base
// for assignments, given that you clearly cite that this is not
// code of your own design.
//
// - Note: This code assumes you’re putting the function in Game.cpp,
// you’ve included WICTextureLoader.h and you have an ID3D11Device
// ComPtr called “device”. Make any adjustments necessary for
// your own implementation.
// --------------------------------------------------------
// Helper for creating a cubemap from 6 individual textures
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> CreateCubemap(
Microsoft::WRL::ComPtr<ID3D11Device> device,
Microsoft::WRL::ComPtr<ID3D11DeviceContext> context,
const wchar_t* right,
const wchar_t* left,
const wchar_t* up,
const wchar_t* down,
const wchar_t* front,
const wchar_t* back);
void InitRenderStates(Microsoft::WRL::ComPtr<ID3D11Device> device);
};