Skip to content

Commit

Permalink
Fixes & Improvements
Browse files Browse the repository at this point in the history
-Get rid of unneeded .bin files
-Resolve most warnings at compilation
-Ditch XCALL macro for safer and faster direct calls since they can be inlined
  • Loading branch information
SaiyansKing committed Sep 14, 2021
1 parent 98ec319 commit 3f8a87f
Show file tree
Hide file tree
Showing 51 changed files with 481 additions and 405 deletions.
3 changes: 3 additions & 0 deletions D3D11Engine/BaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void BaseWidget::OnMButtonClick( int button ) {}
void BaseWidget::OnWindowMessage( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) {}

/** Widget primitives */
#pragma warning(push)
#pragma warning(disable: 6386)
void BaseWidget::CreateArrowCone( int Detail, int Axis, const float4& Color, EditorLinePrimitive* Prim ) {
UINT NumVerts;
NumVerts = Detail * 6;
Expand Down Expand Up @@ -195,6 +197,7 @@ void BaseWidget::CreateArrowCone( int Detail, int Axis, const float4& Color, Edi

delete[] vx;
}
#pragma warning(pop)

void BaseWidget::CreateArrowCube( DirectX::XMFLOAT3* Offset, float Extends, const float4& Color, EditorLinePrimitive* Prim ) {
LineVertex vx[36];
Expand Down
4 changes: 2 additions & 2 deletions D3D11Engine/D2DSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ XRESULT D2DSettingsDialog::InitControls() {
fpsLimitSlider->SetDisplayValues( fpsValues );

// Fix the fps value
fpsLimitSlider->SetValue( Engine::GAPI->GetRendererState().RendererSettings.FpsLimit );
fpsLimitSlider->SetValue( static_cast<float>(Engine::GAPI->GetRendererState().RendererSettings.FpsLimit) );

// Next column
SV_Label* textureQualityLabel = new SV_Label( MainView, MainPanel );
Expand Down Expand Up @@ -495,7 +495,7 @@ XRESULT D2DSettingsDialog::InitControls() {
}

void D2DSettingsDialog::FpsLimitSliderChanged( SV_Slider* sender, void* userdata ) {
int newValue = sender->GetValue();
int newValue = static_cast<int>(sender->GetValue());
Engine::GAPI->GetRendererState().RendererSettings.FpsLimit = newValue <= 25 ? 0 : newValue;
}

Expand Down
137 changes: 70 additions & 67 deletions D3D11Engine/D2DView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,21 @@ HRESULT D2DView::InitResources() {
&pGradientStops
);


RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGradientStops,
&LinearBrush
);

RenderTarget->CreateRadialGradientBrush( D2D1::RadialGradientBrushProperties( D2D1::Point2F( 0, 0 ), D2D1::Point2F( 0, 0 ), 1, 1 ), pGradientStops, &RadialBrush );

SAFE_RELEASE( pGradientStops );
if ( pGradientStops ) {
RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGradientStops,
&LinearBrush
);

RenderTarget->CreateRadialGradientBrush( D2D1::RadialGradientBrushProperties( D2D1::Point2F( 0, 0 ), D2D1::Point2F( 0, 0 ), 1, 1 ), pGradientStops, &RadialBrush );

SAFE_RELEASE( pGradientStops );
}

D2D1_GRADIENT_STOP GUISstops[3];
GUISstops[0].color = D2D1::ColorF( GUI_Color1.r, GUI_Color1.g, GUI_Color1.b, GUI_Color1.a );
Expand All @@ -190,27 +191,26 @@ HRESULT D2DView::InitResources() {
GUISstops[2].color = D2D1::ColorF( GUI_Color3.r, GUI_Color3.g, GUI_Color3.b, GUI_Color3.a );
GUISstops[2].position = 1.0f;



ID2D1GradientStopCollection* pGUI_S_GradientStops;
RenderTarget->CreateGradientStopCollection(
GUISstops,
ARRAYSIZE( GUISstops ),
&pGUI_S_GradientStops
);


RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGUI_S_GradientStops,
&GUIStyleLinearBrush
);

SAFE_RELEASE( pGUI_S_GradientStops );
if ( pGUI_S_GradientStops ) {
RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGUI_S_GradientStops,
&GUIStyleLinearBrush
);

SAFE_RELEASE( pGUI_S_GradientStops );
}

D2D1_GRADIENT_STOP Reflectstops[4];
Reflectstops[0].color = D2D1::ColorF( ReflectColor1.r, ReflectColor1.g, ReflectColor1.b, ReflectColor1.a );
Expand All @@ -225,27 +225,26 @@ HRESULT D2DView::InitResources() {
Reflectstops[3].color = D2D1::ColorF( ReflectColor2.r, ReflectColor2.g, ReflectColor2.b, ReflectColor2.a );
Reflectstops[3].position = 1.0f;



ID2D1GradientStopCollection* pReflectGradientStops;
RenderTarget->CreateGradientStopCollection(
Reflectstops,
ARRAYSIZE( Reflectstops ),
&pReflectGradientStops
);


RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pReflectGradientStops,
&LinearReflectBrush
);

SAFE_RELEASE( pReflectGradientStops );
if ( pReflectGradientStops ) {
RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pReflectGradientStops,
&LinearReflectBrush
);

SAFE_RELEASE( pReflectGradientStops );
}

Reflectstops[0].color = D2D1::ColorF( ReflectColor2.r, ReflectColor2.g, ReflectColor2.b, ReflectColor2.a );
Reflectstops[0].position = 0.0f;
Expand All @@ -265,18 +264,19 @@ HRESULT D2DView::InitResources() {
&pReflectGradientStops
);

RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pReflectGradientStops,
&LinearReflectBrushHigh
);

SAFE_RELEASE( pReflectGradientStops );

if ( pReflectGradientStops ) {
RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pReflectGradientStops,
&LinearReflectBrushHigh
);

SAFE_RELEASE( pReflectGradientStops );
}

D2D1_GRADIENT_STOP bgrstops[2];
bgrstops[0].color = DefBackgroundColor1;
Expand All @@ -291,18 +291,19 @@ HRESULT D2DView::InitResources() {
&pGradientStops
);


RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGradientStops,
&BackgroundBrush
);

SAFE_RELEASE( pGradientStops );
if ( pGradientStops ) {
RenderTarget->CreateLinearGradientBrush(
D2D1::LinearGradientBrushProperties(
D2D1::Point2F( 100, 0 ),
D2D1::Point2F( 100, 200 )
),
D2D1::BrushProperties(),
pGradientStops,
&BackgroundBrush
);

SAFE_RELEASE( pGradientStops );
}

DWriteCreateFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(WriteFactory), (IUnknown**)(&WriteFactory) );

Expand Down Expand Up @@ -330,7 +331,6 @@ HRESULT D2DView::InitResources() {
L"",
&TextFormatBig );


MainSubView = new D2DSubView( this, nullptr );
MainSubView->SetRect( D2D1::RectF( 0, 0, RenderTarget->GetSize().width, RenderTarget->GetSize().height ) );

Expand Down Expand Up @@ -380,6 +380,9 @@ XRESULT D2DView::Resize( const INT2& initialResolution, ID3D11Texture2D* rendert
return XR_FAILED;
}
Factory->CreateDxgiSurfaceRenderTarget( dxgiBackbuffer.Get(), props, &RenderTarget );
if ( !RenderTarget ) {
return XR_FAILED;
}

MainSubView->SetRect( D2D1::RectF( 0, 0, RenderTarget->GetSize().width, RenderTarget->GetSize().height ) );
EditorView->SetRect( D2D1::RectF( 0, 0, RenderTarget->GetSize().width, RenderTarget->GetSize().height ) );
Expand Down
1 change: 0 additions & 1 deletion D3D11Engine/D3D11Engine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ copy "$(OutDir)$(TargetName).pdb" "$(G1_SYSTEM_PATH)\ddraw.pdb"</Command>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_NoOpt_Spacer|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release_NoOpt_G1|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="oCNPC.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Spacer_NET|Win32'">Create</PrecompiledHeader>
Expand Down
3 changes: 0 additions & 3 deletions D3D11Engine/D3D11Engine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,6 @@
<ClCompile Include="StackWalker.cpp">
<Filter>Librarys\StackWalker</Filter>
</ClCompile>
<ClCompile Include="oCNPC.cpp">
<Filter>ZenGin\Classes</Filter>
</ClCompile>
<ClCompile Include="MeshModifier.cpp">
<Filter>Engine\GAPI</Filter>
</ClCompile>
Expand Down
4 changes: 2 additions & 2 deletions D3D11Engine/D3D11GraphicsEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2762,7 +2762,7 @@ void XM_CALLCONV D3D11GraphicsEngine::DrawWorldAround(
} else {
for ( auto&& itx : Engine::GAPI->GetWorldSections() ) {
for ( auto&& ity : itx.second ) {
float vLen; XMStoreFloat( &vLen, XMVector3Length( XMVectorSet( itx.first - s.x, ity.first - s.y, 0, 0 ) ) );
float vLen; XMStoreFloat( &vLen, XMVector3Length( XMVectorSet( static_cast<float>(itx.first - s.x), static_cast<float>(ity.first - s.y), 0, 0 ) ) );

if ( vLen < 2 ) {
WorldMeshSectionInfo& section = ity.second;
Expand Down Expand Up @@ -3058,7 +3058,7 @@ void XM_CALLCONV D3D11GraphicsEngine::DrawWorldAround( FXMVECTOR position,
for ( const auto& ity : itx.second ) {

float len;
XMStoreFloat( &len, XMVector2Length( XMVectorSet( itx.first - s.x, ity.first - s.y, 0, 0 ) ) );
XMStoreFloat( &len, XMVector2Length( XMVectorSet( static_cast<float>(itx.first - s.x), static_cast<float>(ity.first - s.y), 0, 0 ) ) );
if ( len < sectionRange ) {
const WorldMeshSectionInfo& section = ity.second;

Expand Down
2 changes: 1 addition & 1 deletion D3D11Engine/D3D11PFX_SMAA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ void D3D11PFX_SMAA::OnResize( const INT2& size ) {
D3D_SHADER_MACRO HLSL = { "SMAA_HLSL_4_1", "1" };
Makros.push_back( HLSL );

const int QUALITY = 2;
int QUALITY = 2;
switch ( QUALITY ) {
case 0:
{
Expand Down
Loading

0 comments on commit 3f8a87f

Please sign in to comment.