mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Corrige DxHelpers
This commit is contained in:
parent
d264df5909
commit
2d052a229a
@ -270,14 +270,14 @@ namespace xna {
|
||||
description._scaling = static_cast<DisplayModeScaling>(modedesc.Scaling);
|
||||
description._scanlineOrdering = static_cast<DisplayModeScanlineOrder>(modedesc.ScanlineOrdering);
|
||||
|
||||
if (pDisplay && pDisplay->Width == modedesc.Width && pDisplay->Height == modedesc.Height && pDisplay->Format == DxHelpers::ConvertDXGIFORMATToSurface(modedesc.Format)) {
|
||||
if (pDisplay && pDisplay->Width == modedesc.Width && pDisplay->Height == modedesc.Height && pDisplay->Format == DxHelpers::SurfaceFormatToXna(modedesc.Format)) {
|
||||
pDisplay->impl->Descriptions.push_back(description);
|
||||
}
|
||||
else {
|
||||
pDisplay = snew<DisplayMode>();
|
||||
pDisplay->Width = modedesc.Width;
|
||||
pDisplay->Height = modedesc.Height;
|
||||
pDisplay->Format = DxHelpers::ConvertDXGIFORMATToSurface(modedesc.Format);
|
||||
pDisplay->Format = DxHelpers::SurfaceFormatToXna(modedesc.Format);
|
||||
pDisplay->impl->Descriptions.push_back(description);
|
||||
displayList.push_back(pDisplay);
|
||||
}
|
||||
|
@ -10,61 +10,61 @@ namespace xna {
|
||||
impl->dxDescription.AlphaToCoverageEnable = false;
|
||||
impl->dxDescription.IndependentBlendEnable = false;
|
||||
impl->dxDescription.RenderTarget[0].BlendEnable = true;
|
||||
impl->dxDescription.RenderTarget[0].SrcBlend = DxHelpers::ConvertBlend(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].DestBlend = DxHelpers::ConvertBlend(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].BlendOp = DxHelpers::ConvertOperation(BlendFunction::Add);
|
||||
impl->dxDescription.RenderTarget[0].SrcBlendAlpha = DxHelpers::ConvertBlend(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].DestBlendAlpha = DxHelpers::ConvertBlend(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].BlendOpAlpha = DxHelpers::ConvertOperation(BlendFunction::Add);
|
||||
impl->dxDescription.RenderTarget[0].RenderTargetWriteMask = DxHelpers::ConvertColorWrite(ColorWriteChannels::All);
|
||||
impl->dxDescription.RenderTarget[0].SrcBlend = DxHelpers::BlendToDx(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].DestBlend = DxHelpers::BlendToDx(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].BlendOp = DxHelpers::BlendOperationToDx(BlendFunction::Add);
|
||||
impl->dxDescription.RenderTarget[0].SrcBlendAlpha = DxHelpers::BlendToDx(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].DestBlendAlpha = DxHelpers::BlendToDx(Blend::One);
|
||||
impl->dxDescription.RenderTarget[0].BlendOpAlpha = DxHelpers::BlendOperationToDx(BlendFunction::Add);
|
||||
impl->dxDescription.RenderTarget[0].RenderTargetWriteMask = DxHelpers::ColorWriteChannelsToDx(ColorWriteChannels::All);
|
||||
}
|
||||
|
||||
BlendFunction BlendState::AlphaBlendFunction() const {
|
||||
return DxHelpers::ConvertOperationDx(impl->dxDescription.RenderTarget[0].BlendOpAlpha);
|
||||
return DxHelpers::BlendOperationToXna(impl->dxDescription.RenderTarget[0].BlendOpAlpha);
|
||||
}
|
||||
|
||||
void BlendState::AlphaBlendFunction(BlendFunction value) {
|
||||
impl->dxDescription.RenderTarget[0].BlendOpAlpha = DxHelpers::ConvertOperation(value);
|
||||
impl->dxDescription.RenderTarget[0].BlendOpAlpha = DxHelpers::BlendOperationToDx(value);
|
||||
}
|
||||
|
||||
Blend BlendState::AlphaDestinationBlend() const {
|
||||
return DxHelpers::ConvertBlendDx(impl->dxDescription.RenderTarget[0].DestBlendAlpha);
|
||||
return DxHelpers::BlendToXna(impl->dxDescription.RenderTarget[0].DestBlendAlpha);
|
||||
}
|
||||
|
||||
void BlendState::AlphaDestinationBlend(Blend value) {
|
||||
impl->dxDescription.RenderTarget[0].DestBlendAlpha = DxHelpers::ConvertBlend(value);
|
||||
impl->dxDescription.RenderTarget[0].DestBlendAlpha = DxHelpers::BlendToDx(value);
|
||||
}
|
||||
|
||||
Blend BlendState::AlphaSourceBlend() const {
|
||||
return DxHelpers::ConvertBlendDx(impl->dxDescription.RenderTarget[0].SrcBlendAlpha);
|
||||
return DxHelpers::BlendToXna(impl->dxDescription.RenderTarget[0].SrcBlendAlpha);
|
||||
}
|
||||
|
||||
void BlendState::AlphaSourceBlend(Blend value) {
|
||||
impl->dxDescription.RenderTarget[0].SrcBlendAlpha = DxHelpers::ConvertBlend(value);
|
||||
impl->dxDescription.RenderTarget[0].SrcBlendAlpha = DxHelpers::BlendToDx(value);
|
||||
}
|
||||
|
||||
BlendFunction BlendState::ColorBlendFunction() const {
|
||||
return DxHelpers::ConvertOperationDx(impl->dxDescription.RenderTarget[0].BlendOp);
|
||||
return DxHelpers::BlendOperationToXna(impl->dxDescription.RenderTarget[0].BlendOp);
|
||||
}
|
||||
|
||||
void BlendState::ColorBlendFunction(BlendFunction value) {
|
||||
impl->dxDescription.RenderTarget[0].BlendOp = DxHelpers::ConvertOperation(value);
|
||||
impl->dxDescription.RenderTarget[0].BlendOp = DxHelpers::BlendOperationToDx(value);
|
||||
}
|
||||
|
||||
Blend BlendState::ColorDestinationBlend() const {
|
||||
return DxHelpers::ConvertBlendDx(impl->dxDescription.RenderTarget[0].DestBlend);
|
||||
return DxHelpers::BlendToXna(impl->dxDescription.RenderTarget[0].DestBlend);
|
||||
}
|
||||
|
||||
void BlendState::ColorDestinationBlend(Blend value) {
|
||||
impl->dxDescription.RenderTarget[0].DestBlend = DxHelpers::ConvertBlend(value);
|
||||
impl->dxDescription.RenderTarget[0].DestBlend = DxHelpers::BlendToDx(value);
|
||||
}
|
||||
|
||||
Blend BlendState::ColorSourceBlend() const {
|
||||
return DxHelpers::ConvertBlendDx(impl->dxDescription.RenderTarget[0].SrcBlend);
|
||||
return DxHelpers::BlendToXna(impl->dxDescription.RenderTarget[0].SrcBlend);
|
||||
}
|
||||
|
||||
void BlendState::ColorSourceBlend(Blend value) {
|
||||
impl->dxDescription.RenderTarget[0].SrcBlend = DxHelpers::ConvertBlend(value);
|
||||
impl->dxDescription.RenderTarget[0].SrcBlend = DxHelpers::BlendToDx(value);
|
||||
}
|
||||
|
||||
Color BlendState::BlendFactor() const {
|
||||
@ -144,13 +144,13 @@ namespace xna {
|
||||
void BlendState::RenderTargets(std::vector<BlendRenderTarget> const& value) {
|
||||
for (size_t i = 0; i < value.size() && i < 8; ++i) {
|
||||
impl->dxDescription.RenderTarget[i].BlendEnable = value[i].Enabled;
|
||||
impl->dxDescription.RenderTarget[i].SrcBlend = DxHelpers::ConvertBlend(value[i].Source);
|
||||
impl->dxDescription.RenderTarget[i].DestBlend = DxHelpers::ConvertBlend(value[i].Destination);
|
||||
impl->dxDescription.RenderTarget[i].BlendOp = DxHelpers::ConvertOperation(value[i].Operation);
|
||||
impl->dxDescription.RenderTarget[i].SrcBlendAlpha = DxHelpers::ConvertBlend(value[i].SourceAlpha);
|
||||
impl->dxDescription.RenderTarget[i].DestBlendAlpha = DxHelpers::ConvertBlend(value[i].DestinationAlpha);
|
||||
impl->dxDescription.RenderTarget[i].BlendOpAlpha = DxHelpers::ConvertOperation(value[i].OperationAlpha);
|
||||
impl->dxDescription.RenderTarget[i].RenderTargetWriteMask = DxHelpers::ConvertColorWrite(value[i].WriteMask);
|
||||
impl->dxDescription.RenderTarget[i].SrcBlend = DxHelpers::BlendToDx(value[i].Source);
|
||||
impl->dxDescription.RenderTarget[i].DestBlend = DxHelpers::BlendToDx(value[i].Destination);
|
||||
impl->dxDescription.RenderTarget[i].BlendOp = DxHelpers::BlendOperationToDx(value[i].Operation);
|
||||
impl->dxDescription.RenderTarget[i].SrcBlendAlpha = DxHelpers::BlendToDx(value[i].SourceAlpha);
|
||||
impl->dxDescription.RenderTarget[i].DestBlendAlpha = DxHelpers::BlendToDx(value[i].DestinationAlpha);
|
||||
impl->dxDescription.RenderTarget[i].BlendOpAlpha = DxHelpers::BlendOperationToDx(value[i].OperationAlpha);
|
||||
impl->dxDescription.RenderTarget[i].RenderTargetWriteMask = DxHelpers::ColorWriteChannelsToDx(value[i].WriteMask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,15 +163,15 @@ namespace xna {
|
||||
}
|
||||
|
||||
void SamplerState::AddressU(TextureAddressMode value) {
|
||||
DxHelpers::ConvertAddressMode(value, impl->_description.AddressU);
|
||||
impl->_description.AddressU = DxHelpers::TextureAddresModeToDx(value);
|
||||
}
|
||||
|
||||
void SamplerState::AddressV(TextureAddressMode value) {
|
||||
DxHelpers::ConvertAddressMode(value, impl->_description.AddressV);
|
||||
impl->_description.AddressV = DxHelpers::TextureAddresModeToDx(value);
|
||||
}
|
||||
|
||||
void SamplerState::AddressW(TextureAddressMode value) {
|
||||
DxHelpers::ConvertAddressMode(value, impl->_description.AddressW);
|
||||
impl->_description.AddressW = DxHelpers::TextureAddresModeToDx(value);
|
||||
}
|
||||
|
||||
void SamplerState::Comparison(ComparisonFunction value) {
|
||||
@ -221,21 +221,15 @@ namespace xna {
|
||||
}
|
||||
|
||||
TextureAddressMode SamplerState::AddressU() const {
|
||||
TextureAddressMode mode;
|
||||
DxHelpers::ConvertAddressMode(impl->_description.AddressU, mode);
|
||||
return mode;
|
||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressU);
|
||||
}
|
||||
|
||||
TextureAddressMode SamplerState::AddressV() const {
|
||||
TextureAddressMode mode;
|
||||
DxHelpers::ConvertAddressMode(impl->_description.AddressV, mode);
|
||||
return mode;
|
||||
TextureAddressMode SamplerState::AddressV() const {
|
||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressV);
|
||||
}
|
||||
|
||||
TextureAddressMode SamplerState::AddressW() const {
|
||||
TextureAddressMode mode;
|
||||
DxHelpers::ConvertAddressMode(impl->_description.AddressW, mode);
|
||||
return mode;
|
||||
TextureAddressMode SamplerState::AddressW() const {
|
||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressW);
|
||||
}
|
||||
|
||||
ComparisonFunction SamplerState::Comparison() const {
|
||||
|
@ -136,13 +136,12 @@ namespace xna {
|
||||
Viewport(device->Viewport());
|
||||
}
|
||||
|
||||
void SpriteBatch::Begin(SpriteSortMode sortMode, BlendState* blendState, SamplerState* samplerState, DepthStencilState* depthStencil, RasterizerState* rasterizerState, Matrix const& transformMatrix) {
|
||||
void SpriteBatch::Begin(SpriteSortMode sortMode, BlendState* blendState, SamplerState* samplerState, DepthStencilState* depthStencil, RasterizerState* rasterizerState, Effect* effect, Matrix const& transformMatrix) {
|
||||
|
||||
if (!implementation->_dxspriteBatch)
|
||||
return;
|
||||
|
||||
DxSpriteSortMode sort;
|
||||
DxHelpers::SpriteSortToDx(sortMode, sort);
|
||||
DxSpriteSortMode sort = DxHelpers::SpriteSortToDx(sortMode);
|
||||
|
||||
const auto& t = transformMatrix;
|
||||
DxMatrix matrix = DxMatrix(
|
||||
@ -151,7 +150,6 @@ namespace xna {
|
||||
t.M31, t.M32, t.M33, t.M34,
|
||||
t.M41, t.M42, t.M43, t.M44);
|
||||
|
||||
|
||||
implementation->_dxspriteBatch->Begin(
|
||||
sort,
|
||||
blendState ? blendState->impl->dxBlendState.Get() : nullptr,
|
||||
|
@ -62,6 +62,7 @@ namespace xna {
|
||||
class DepthStencilState;
|
||||
class DisplayMode;
|
||||
class DisplayModeCollection;
|
||||
class Effect;
|
||||
class GraphicsAdapter;
|
||||
class GraphicsDevice;
|
||||
class GraphicsDeviceInformation;
|
||||
|
@ -20,7 +20,7 @@ namespace xna {
|
||||
SamplerState* samplerState = nullptr,
|
||||
DepthStencilState* depthStencil = nullptr,
|
||||
RasterizerState* rasterizerState = nullptr,
|
||||
//Effect
|
||||
Effect* effect = nullptr,
|
||||
Matrix const& transformMatrix = Matrix::Identity()
|
||||
);
|
||||
|
||||
|
@ -99,8 +99,8 @@ namespace xna {
|
||||
//==============================================//
|
||||
|
||||
struct DxHelpers {
|
||||
static constexpr void SpriteSortToDx(SpriteSortMode value, DirectX::SpriteSortMode& target) {
|
||||
target = static_cast<DirectX::SpriteSortMode>(static_cast<int>(value));
|
||||
static constexpr DirectX::SpriteSortMode SpriteSortToDx(SpriteSortMode value) {
|
||||
return static_cast<DirectX::SpriteSortMode>(static_cast<int>(value));
|
||||
}
|
||||
|
||||
static constexpr DXGI_FORMAT SurfaceFormatToDx(SurfaceFormat format)
|
||||
@ -152,7 +152,7 @@ namespace xna {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr SurfaceFormat ConvertDXGIFORMATToSurface(DXGI_FORMAT format) {
|
||||
static constexpr SurfaceFormat SurfaceFormatToXna(DXGI_FORMAT format) {
|
||||
switch (format)
|
||||
{
|
||||
case DXGI_FORMAT_R8G8B8A8_UNORM:
|
||||
@ -197,7 +197,7 @@ namespace xna {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr Blend ConvertBlendDx(D3D11_BLEND blend) {
|
||||
static constexpr Blend BlendToXna(D3D11_BLEND blend) {
|
||||
switch (blend) {
|
||||
case D3D11_BLEND_ZERO:
|
||||
return Blend::Zero;
|
||||
@ -238,7 +238,7 @@ namespace xna {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr D3D11_BLEND ConvertBlend(Blend blend) {
|
||||
static constexpr D3D11_BLEND BlendToDx(Blend blend) {
|
||||
switch (blend)
|
||||
{
|
||||
case xna::Blend::Zero:
|
||||
@ -280,15 +280,15 @@ namespace xna {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr D3D11_BLEND_OP ConvertOperation(BlendOperation op) {
|
||||
static constexpr D3D11_BLEND_OP BlendOperationToDx(BlendOperation op) {
|
||||
return static_cast<D3D11_BLEND_OP>(static_cast<int>(op) + 1);
|
||||
}
|
||||
|
||||
static constexpr BlendOperation ConvertOperationDx(D3D11_BLEND_OP op) {
|
||||
static constexpr BlendOperation BlendOperationToXna(D3D11_BLEND_OP op) {
|
||||
return static_cast<BlendOperation>(static_cast<int>(op) - 1);
|
||||
}
|
||||
|
||||
static constexpr D3D11_COLOR_WRITE_ENABLE ConvertColorWrite(ColorWriteChannels colorWrite) {
|
||||
static constexpr D3D11_COLOR_WRITE_ENABLE ColorWriteChannelsToDx(ColorWriteChannels colorWrite) {
|
||||
switch (colorWrite)
|
||||
{
|
||||
case xna::ColorWriteChannels::Red:
|
||||
@ -306,12 +306,12 @@ namespace xna {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr void ConvertAddressMode(TextureAddressMode value, D3D11_TEXTURE_ADDRESS_MODE& target) {
|
||||
target = static_cast<D3D11_TEXTURE_ADDRESS_MODE>(static_cast<int>(value) + 1);
|
||||
static constexpr D3D11_TEXTURE_ADDRESS_MODE TextureAddresModeToDx(TextureAddressMode value) {
|
||||
return static_cast<D3D11_TEXTURE_ADDRESS_MODE>(static_cast<int>(value) + 1);
|
||||
}
|
||||
|
||||
static constexpr void ConvertAddressMode(D3D11_TEXTURE_ADDRESS_MODE value, TextureAddressMode& target) {
|
||||
target = static_cast<TextureAddressMode>(value - 1);
|
||||
static constexpr TextureAddressMode TextureAddresModeToXna(D3D11_TEXTURE_ADDRESS_MODE value) {
|
||||
return static_cast<TextureAddressMode>(value - 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,24 +1,20 @@
|
||||
#define NOMINMAX
|
||||
#include "types.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "enums.hpp"
|
||||
#include "exception.hpp"
|
||||
#include "audio/audioengine.hpp"
|
||||
#include "audio/soundeffect.hpp"
|
||||
#include "common/collision.hpp"
|
||||
#include "common/color.hpp"
|
||||
#include "common/curve.hpp"
|
||||
#include "common/gjk.hpp"
|
||||
#include "common/math.hpp"
|
||||
#include "common/packedvalue.hpp"
|
||||
#include "common/numerics.hpp"
|
||||
#include "common/collision.hpp"
|
||||
#include "content/readers/default.hpp"
|
||||
#include "content/readers/graphics.hpp"
|
||||
#include "content/readers/audio.hpp"
|
||||
#include "common/packedvalue.hpp"
|
||||
#include "content/lzx/decoder.hpp"
|
||||
#include "content/manager.hpp"
|
||||
#include "content/reader.hpp"
|
||||
#include "content/readers/audio.hpp"
|
||||
#include "content/readers/default.hpp"
|
||||
#include "content/readers/graphics.hpp"
|
||||
#include "content/typereadermanager.hpp"
|
||||
#include "content/lzx/decoder.hpp"
|
||||
#include "csharp/binary.hpp"
|
||||
#include "csharp/buffer.hpp"
|
||||
#include "csharp/object.hpp"
|
||||
@ -26,6 +22,8 @@
|
||||
#include "csharp/stream.hpp"
|
||||
#include "csharp/timespan.hpp"
|
||||
#include "csharp/type.hpp"
|
||||
#include "enums.hpp"
|
||||
#include "exception.hpp"
|
||||
#include "game/component.hpp"
|
||||
#include "game/game.hpp"
|
||||
#include "game/gdeviceinfo.hpp"
|
||||
@ -48,8 +46,10 @@
|
||||
#include "graphics/texture.hpp"
|
||||
#include "graphics/vertexposition.hpp"
|
||||
#include "graphics/viewport.hpp"
|
||||
#include "helpers.hpp"
|
||||
#include "input/gamepad.hpp"
|
||||
#include "input/keyboard.hpp"
|
||||
#include "input/mouse.hpp"
|
||||
#include "platforminit.hpp"
|
||||
#include "types.hpp"
|
||||
#include "xna/platform-dx/dx.hpp"
|
Loading…
x
Reference in New Issue
Block a user