21 {-1,-1,-1}, {-1,+1,-1}, {+1,+1,-1}, {+1,-1,-1},
22 {-1,-1,+1}, {-1,+1,+1}, {+1,+1,+1}, {+1,-1,+1},
25 const unsigned int indices[] =
42 m_skybox = EU::MakeShared<Actor>(device);
46 std::vector<MeshComponent> skybox;
57 ERROR(
"Skybox",
"Init",
"Failed to create Skybox Actor.");
65 builder.
Add(
"POSITION", DXGI_FORMAT_R32G32B32_FLOAT);
71 ERROR(
"Skybox",
"init",
72 (
"Failed to initialize ShaderProgram. HRESULT: " + std::to_string(hr)).c_str());
79 ERROR(
"Skybox",
"init",
80 (
"Failed to initialize NeverChanges Buffer. HRESULT: " + std::to_string(hr)).c_str());
87 ERROR(
"Skybox",
"init",
"Failed to create new SamplerState");
93 ERROR(
"Skybox",
"init",
"Failed to create new RasterizerState");
98 D3D11_DEPTH_WRITE_MASK_ZERO,
99 D3D11_COMPARISON_LESS_EQUAL);
101 ERROR(
"Skybox",
"init",
"Failed to create new DepthStencilState");
110 XMMATRIX vp = viewNoT * camera.
getProj();
138 ID3D11ShaderResourceView* nullSRV[1] = {
nullptr };
Declara la API de DeviceContext dentro del subsistema Core.
Declara la API de Device dentro del subsistema Core.
Declara la API de LayoutBuilder dentro del subsistema Utilities.
#define ERROR(classObj, method, errorMSG)
Declara la API de Skybox dentro del subsistema Utilities.
void setName(const std::string &name)
Establece el nombre del actor.
void setMesh(Device &device, std::vector< MeshComponent > meshes)
Establece las mallas del actor.
void renderForSkybox(DeviceContext &deviceContext)
void update(DeviceContext &deviceContext, ID3D11Resource *pDstResource, unsigned int DstSubresource, const D3D11_BOX *pDstBox, const void *pSrcData, unsigned int SrcRowPitch, unsigned int SrcDepthPitch)
Actualiza el contenido del buffer (típicamente mediante UpdateSubresource).
HRESULT init(Device &device, const MeshComponent &mesh, unsigned int bindFlag)
Inicializa el buffer como Vertex o Index Buffer usando un MeshComponent.
void render(DeviceContext &deviceContext, unsigned int StartSlot, unsigned int NumBuffers, bool setPixelShader=false, DXGI_FORMAT format=DXGI_FORMAT_UNKNOWN)
Enlaza el buffer a la etapa correspondiente del pipeline para el frame de render.
XMMATRIX getProj() const
Matriz Projection (vista->clip).
XMMATRIX GetViewNoTranslation() const
View sin traslación (solo rotación).
HRESULT init(Device &device, bool depthEnable, D3D11_DEPTH_WRITE_MASK writeMask, D3D11_COMPARISON_FUNC depthFunc)
Crea el objeto ID3D11DepthStencilState a partir de flags comunes.
void render(DeviceContext &deviceContext, unsigned int stencilRef=0, bool reset=false)
Aplica el estado de profundidad/esténcil al contexto (OMSetDepthStencilState).
ID3D11DeviceContext * m_deviceContext
Puntero al contexto inmediato de Direct3D 11.
Encapsula un ID3D11Device y facilita la creación de recursos gráficos en Direct3D 11.
bool isNull() const
Comprobar si el puntero es nulo.
LayoutBuilder & Add(const char *semantic, DXGI_FORMAT format, UINT semanticIndex=0, UINT inputSlot=0, UINT alignedByteOffset=D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_CLASSIFICATION slotClass=D3D11_INPUT_PER_VERTEX_DATA, UINT instanceStepRate=0)
const std::vector< MeshComponent > & GetMeshes() const
void render(DeviceContext &deviceContext)
Aplica el Rasterizer State al contexto de dispositivo.
HRESULT init(Device device)
Inicializa el Rasterizer State.
HRESULT init(Device &device)
Inicializa el Sampler State con una configuración predeterminada.
void render(DeviceContext &deviceContext, unsigned int StartSlot, unsigned int NumSamplers)
Asigna el Sampler State a la etapa de Pixel Shader.
void render(DeviceContext &deviceContext)
Aplica el Vertex Shader, Pixel Shader e Input Layout al pipeline.
HRESULT init(Device &device, const std::string &fileName, LayoutBuilder layoutBuilder)
Inicializa el programa de shaders desde un archivo HLSL.
HRESULT init(Device &device, DeviceContext *deviceContext, Texture &cubemap)
EU::TSharedPointer< Actor > m_skybox
ShaderProgram m_shaderProgram
SamplerState m_samplerState
DepthStencilState m_depthStencilState
void render(DeviceContext &deviceContext)
void update(DeviceContext &deviceContext, Camera &camera)
RasterizerState m_rasterizerState
Encapsula una textura 2D en Direct3D 11, incluyendo su recurso y vista como Shader Resource.
void render(DeviceContext &deviceContext, unsigned int StartSlot, unsigned int NumViews)
Asigna la textura al pipeline de render.
ID3D11ShaderResourceView * m_textureFromImg
Vista de la textura como recurso de shader.