mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Implementa método Apply em SamplerStateCollection
This commit is contained in:
parent
587960d0f2
commit
513292aae7
@ -45,6 +45,35 @@ namespace xna {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SamplerStateCollection::Apply(GraphicsDevice const& device) {
|
||||
if (samplers.empty())
|
||||
return;
|
||||
|
||||
if (!device.impl || !device.impl->_device || !device.impl->_context) {
|
||||
Exception::Throw(ExMessage::InvalidOperation);
|
||||
}
|
||||
|
||||
std::vector<ID3D11SamplerState*> states(samplers.size());
|
||||
|
||||
for (size_t i = 0; i < samplers.size(); ++i) {
|
||||
const auto& current = samplers[0];
|
||||
|
||||
if (!current || !current->impl || !current->impl->_samplerState)
|
||||
Exception::Throw(ExMessage::InvalidOperation);
|
||||
|
||||
states[i] = current->impl->_samplerState;
|
||||
states[i]->AddRef();
|
||||
}
|
||||
|
||||
device.impl->_context->PSSetSamplers(0, states.size(), states.data());
|
||||
|
||||
for (size_t i = 0; i < samplers.size(); ++i) {
|
||||
states[i]->Release();
|
||||
states[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
uptr<SamplerState> SamplerState::PoinWrap() {
|
||||
auto state = unew<SamplerState>();
|
||||
state->impl->_description.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
|
@ -91,6 +91,8 @@ namespace xna {
|
||||
return samplers[index];
|
||||
}
|
||||
|
||||
void Apply(GraphicsDevice const& device);
|
||||
|
||||
public:
|
||||
std::vector<PSamplerState> samplers;
|
||||
};
|
||||
|
@ -966,6 +966,8 @@ namespace xna {
|
||||
_depthStencilState->Bind(device);
|
||||
_depthStencilState->Initialize();
|
||||
_depthStencilState->Apply();
|
||||
|
||||
_samplerStates->Apply(*device);
|
||||
}
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user