From 5b32f0fd298c915dae8c55c5b11291b20731ca8b Mon Sep 17 00:00:00 2001 From: turanszkij Date: Wed, 9 Dec 2015 00:15:33 +0100 Subject: [PATCH] minor updates --- .../DeferredRenderableComponent_BindLua.cpp | 1 + .../ForwardRenderableComponent_BindLua.cpp | 1 + WickedEngine/Renderable3DComponent.cpp | 3 +- WickedEngine/Renderable3DComponent.h | 115 +++++++++--------- .../Renderable3DComponent_BindLua.cpp | 14 +++ WickedEngine/Renderable3DComponent_BindLua.h | 1 + WickedEngine/wiBackLog.cpp | 2 +- WickedEngine/wiImage.cpp | 14 +-- WickedEngine/wiLoader.h | 10 +- 9 files changed, 88 insertions(+), 73 deletions(-) diff --git a/WickedEngine/DeferredRenderableComponent_BindLua.cpp b/WickedEngine/DeferredRenderableComponent_BindLua.cpp index abb345dcb..cda335589 100644 --- a/WickedEngine/DeferredRenderableComponent_BindLua.cpp +++ b/WickedEngine/DeferredRenderableComponent_BindLua.cpp @@ -37,6 +37,7 @@ Luna::FunctionType DeferredRenderableCompon lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), + lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), diff --git a/WickedEngine/ForwardRenderableComponent_BindLua.cpp b/WickedEngine/ForwardRenderableComponent_BindLua.cpp index 1a5be1400..047010322 100644 --- a/WickedEngine/ForwardRenderableComponent_BindLua.cpp +++ b/WickedEngine/ForwardRenderableComponent_BindLua.cpp @@ -37,6 +37,7 @@ Luna::FunctionType ForwardRenderableComponen lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), + lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), diff --git a/WickedEngine/Renderable3DComponent.cpp b/WickedEngine/Renderable3DComponent.cpp index 79f13d9cd..2e19e1bfa 100644 --- a/WickedEngine/Renderable3DComponent.cpp +++ b/WickedEngine/Renderable3DComponent.cpp @@ -43,6 +43,7 @@ void Renderable3DComponent::setProperties() setColorGradingEnabled(true); setEmitterParticlesEnabled(true); setHairParticlesEnabled(true); + setHairParticlesReflectionEnabled(false); setVolumeLightsEnabled(true); setLightShaftsEnabled(true); setLensFlareEnabled(true); @@ -212,7 +213,7 @@ void Renderable3DComponent::RenderReflections(wiRenderer::DeviceContext context) wiRenderer::UpdatePerViewCB(context, wiRenderer::getRefCamera(), wiRenderer::getCamera(), water); wiRenderer::DrawWorld(wiRenderer::getRefCamera(), false, 0, context , false, wiRenderer::SHADED_NONE - , nullptr, true, GRAPHICSTHREAD_REFLECTIONS); + , nullptr, getHairParticlesReflectionEnabled(), GRAPHICSTHREAD_REFLECTIONS); wiRenderer::DrawSky(context); } } diff --git a/WickedEngine/Renderable3DComponent.h b/WickedEngine/Renderable3DComponent.h index dec852d0b..a08920e46 100644 --- a/WickedEngine/Renderable3DComponent.h +++ b/WickedEngine/Renderable3DComponent.h @@ -32,6 +32,7 @@ private: bool colorGradingEnabled; bool emittedParticlesEnabled; bool hairParticlesEnabled; + bool hairParticlesReflectionEnabled; bool volumeLightsEnabled; bool lightShaftsEnabled; bool lensFlareEnabled; @@ -70,69 +71,71 @@ protected: virtual void RenderComposition2(wiRenderer::DeviceContext context = wiRenderer::getImmediateContext()); virtual void RenderColorGradedComposition(); public: - float getLightShaftQuality(){ return lightShaftQuality; } - float getBloomDownSample(){ return bloomDownSample; } - float getBloomStrength(){ return bloomStren; } - float getBloomThreshold(){ return bloomThreshold; } - float getBloomSaturation(){ return bloomSaturation; } - float getAlphaParticleDownSample(){ return particleAlphaDownSample; } - float getAdditiveParticleDownSample(){ return particleAdditiveDownSample; } - float getReflectionQuality(){ return reflectionQuality; } - float getSSAOQuality(){ return ssaoQuality; } - float getSSAOBlur(){ return ssaoBlur; } - float getDepthOfFieldFocus(){ return dofFocus; } - float getDepthOfFieldStrength(){ return dofStrength; } + inline float getLightShaftQuality(){ return lightShaftQuality; } + inline float getBloomDownSample(){ return bloomDownSample; } + inline float getBloomStrength(){ return bloomStren; } + inline float getBloomThreshold(){ return bloomThreshold; } + inline float getBloomSaturation(){ return bloomSaturation; } + inline float getAlphaParticleDownSample(){ return particleAlphaDownSample; } + inline float getAdditiveParticleDownSample(){ return particleAdditiveDownSample; } + inline float getReflectionQuality(){ return reflectionQuality; } + inline float getSSAOQuality(){ return ssaoQuality; } + inline float getSSAOBlur(){ return ssaoBlur; } + inline float getDepthOfFieldFocus(){ return dofFocus; } + inline float getDepthOfFieldStrength(){ return dofStrength; } wiWaterPlane getWaterPlane(){ return waterPlane; } - bool getSSAOEnabled(){ return ssaoEnabled; } - bool getSSREnabled(){ return ssrEnabled; } - bool getShadowsEnabled(){ return shadowsEnabled; } - bool getReflectionsEnabled(){ return reflectionsEnabled; } - bool getFXAAEnabled(){ return fxaaEnabled; } - bool getBloomEnabled(){ return bloomEnabled; } - bool getColorGradingEnabled(){ return colorGradingEnabled; } - bool getEmittedParticlesEnabled(){ return emittedParticlesEnabled; } - bool getHairParticlesEnabled(){ return hairParticlesEnabled; } - bool getVolumeLightsEnabled(){ return volumeLightsEnabled; } - bool getLightShaftsEnabled(){ return lightShaftsEnabled; } - bool getLensFlareEnabled(){ return lensFlareEnabled; } - bool getMotionBlurEnabled(){ return motionBlurEnabled; } - bool getSSSEnabled(){ return sssEnabled; } - bool getDepthOfFieldEnabled(){ return depthOfFieldEnabled; } + inline bool getSSAOEnabled(){ return ssaoEnabled; } + inline bool getSSREnabled(){ return ssrEnabled; } + inline bool getShadowsEnabled(){ return shadowsEnabled; } + inline bool getReflectionsEnabled(){ return reflectionsEnabled; } + inline bool getFXAAEnabled(){ return fxaaEnabled; } + inline bool getBloomEnabled(){ return bloomEnabled; } + inline bool getColorGradingEnabled(){ return colorGradingEnabled; } + inline bool getEmittedParticlesEnabled(){ return emittedParticlesEnabled; } + inline bool getHairParticlesEnabled() { return hairParticlesEnabled; } + inline bool getHairParticlesReflectionEnabled() { return hairParticlesReflectionEnabled; } + inline bool getVolumeLightsEnabled(){ return volumeLightsEnabled; } + inline bool getLightShaftsEnabled(){ return lightShaftsEnabled; } + inline bool getLensFlareEnabled(){ return lensFlareEnabled; } + inline bool getMotionBlurEnabled(){ return motionBlurEnabled; } + inline bool getSSSEnabled(){ return sssEnabled; } + inline bool getDepthOfFieldEnabled(){ return depthOfFieldEnabled; } - unsigned short getThreadingCount(){ return (unsigned short)workerThreads.size(); } + inline unsigned int getThreadingCount(){ return (unsigned int)workerThreads.size(); } - void setLightShaftQuality(float value){ lightShaftQuality = value; } - void setBloomDownSample(float value){ bloomDownSample = value; } - void setBloomStrength(float value){ bloomStren = value; } - void setBloomThreshold(float value){ bloomThreshold = value; } - void setBloomSaturation(float value){ bloomSaturation = value; } - void setAlphaParticleDownSample(float value){ particleAlphaDownSample = value; } - void setAdditiveParticleDownSample(float value){ particleAdditiveDownSample = value; } - void setReflectionQuality(float value){ reflectionQuality = value; } - void setSSAOQuality(float value){ ssaoQuality = value; } - void setSSAOBlur(float value){ ssaoBlur = value; } - void setDepthOfFieldFocus(float value){ dofFocus = value; } - void setDepthOfFieldStrength(float value){ dofStrength = value; } + inline void setLightShaftQuality(float value){ lightShaftQuality = value; } + inline void setBloomDownSample(float value){ bloomDownSample = value; } + inline void setBloomStrength(float value){ bloomStren = value; } + inline void setBloomThreshold(float value){ bloomThreshold = value; } + inline void setBloomSaturation(float value){ bloomSaturation = value; } + inline void setAlphaParticleDownSample(float value){ particleAlphaDownSample = value; } + inline void setAdditiveParticleDownSample(float value){ particleAdditiveDownSample = value; } + inline void setReflectionQuality(float value){ reflectionQuality = value; } + inline void setSSAOQuality(float value){ ssaoQuality = value; } + inline void setSSAOBlur(float value){ ssaoBlur = value; } + inline void setDepthOfFieldFocus(float value){ dofFocus = value; } + inline void setDepthOfFieldStrength(float value){ dofStrength = value; } - void setWaterPlane(const wiWaterPlane& value){ waterPlane = value; } + inline void setWaterPlane(const wiWaterPlane& value){ waterPlane = value; } - void setSSAOEnabled(bool value){ ssaoEnabled = value; } - void setSSREnabled(bool value){ ssrEnabled = value; } - void setShadowsEnabled(bool value){ shadowsEnabled = value; } - void setReflectionsEnabled(bool value){ reflectionsEnabled = value; } - void setFXAAEnabled(bool value){ fxaaEnabled = value; } - void setBloomEnabled(bool value){ bloomEnabled = value; } - void setColorGradingEnabled(bool value){ colorGradingEnabled = value; } - void setEmitterParticlesEnabled(bool value){ emittedParticlesEnabled = value; } - void setHairParticlesEnabled(bool value){ hairParticlesEnabled = value; } - void setVolumeLightsEnabled(bool value){ volumeLightsEnabled = value; } - void setLightShaftsEnabled(bool value){ lightShaftsEnabled = value; } - void setLensFlareEnabled(bool value){ lensFlareEnabled = value; } - void setMotionBlurEnabled(bool value){ motionBlurEnabled = value; } - void setSSSEnabled(bool value){ sssEnabled = value; } - void setDepthOfFieldEnabled(bool value){ depthOfFieldEnabled = value; } + inline void setSSAOEnabled(bool value){ ssaoEnabled = value; } + inline void setSSREnabled(bool value){ ssrEnabled = value; } + inline void setShadowsEnabled(bool value){ shadowsEnabled = value; } + inline void setReflectionsEnabled(bool value){ reflectionsEnabled = value; } + inline void setFXAAEnabled(bool value){ fxaaEnabled = value; } + inline void setBloomEnabled(bool value){ bloomEnabled = value; } + inline void setColorGradingEnabled(bool value){ colorGradingEnabled = value; } + inline void setEmitterParticlesEnabled(bool value){ emittedParticlesEnabled = value; } + inline void setHairParticlesEnabled(bool value) { hairParticlesEnabled = value; } + inline void setHairParticlesReflectionEnabled(bool value) { hairParticlesReflectionEnabled = value; } + inline void setVolumeLightsEnabled(bool value){ volumeLightsEnabled = value; } + inline void setLightShaftsEnabled(bool value){ lightShaftsEnabled = value; } + inline void setLensFlareEnabled(bool value){ lensFlareEnabled = value; } + inline void setMotionBlurEnabled(bool value){ motionBlurEnabled = value; } + inline void setSSSEnabled(bool value){ sssEnabled = value; } + inline void setDepthOfFieldEnabled(bool value){ depthOfFieldEnabled = value; } virtual void setPreferredThreadingCount(unsigned short value); diff --git a/WickedEngine/Renderable3DComponent_BindLua.cpp b/WickedEngine/Renderable3DComponent_BindLua.cpp index 5bb7250dd..9e63e3000 100644 --- a/WickedEngine/Renderable3DComponent_BindLua.cpp +++ b/WickedEngine/Renderable3DComponent_BindLua.cpp @@ -38,6 +38,7 @@ Luna::FunctionType Renderable3DComponent_BindLua: lunamethod(Renderable3DComponent_BindLua, SetColorGradingEnabled), lunamethod(Renderable3DComponent_BindLua, SetEmitterParticlesEnabled), lunamethod(Renderable3DComponent_BindLua, SetHairParticlesEnabled), + lunamethod(Renderable3DComponent_BindLua, SetHairParticlesReflectionEnabled), lunamethod(Renderable3DComponent_BindLua, SetVolumeLightsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLightShaftsEnabled), lunamethod(Renderable3DComponent_BindLua, SetLensFlareEnabled), @@ -187,6 +188,19 @@ int Renderable3DComponent_BindLua::SetHairParticlesEnabled(lua_State* L) wiLua::SError(L, "SetHairParticlesEnabled(bool value) not enough arguments!"); return 0; } +int Renderable3DComponent_BindLua::SetHairParticlesReflectionEnabled(lua_State* L) +{ + if (component == nullptr) + { + wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) component is null!"); + return 0; + } + if (wiLua::SGetArgCount(L) > 0) + ((Renderable3DComponent*)component)->setHairParticlesReflectionEnabled(wiLua::SGetBool(L, 1)); + else + wiLua::SError(L, "SetHairParticlesReflectionEnabled(bool value) not enough arguments!"); + return 0; +} int Renderable3DComponent_BindLua::SetVolumeLightsEnabled(lua_State* L) { if (component == nullptr) diff --git a/WickedEngine/Renderable3DComponent_BindLua.h b/WickedEngine/Renderable3DComponent_BindLua.h index 24ea7afdd..3a3f02cf0 100644 --- a/WickedEngine/Renderable3DComponent_BindLua.h +++ b/WickedEngine/Renderable3DComponent_BindLua.h @@ -24,6 +24,7 @@ public: int SetColorGradingEnabled(lua_State* L); int SetEmitterParticlesEnabled(lua_State* L); int SetHairParticlesEnabled(lua_State* L); + int SetHairParticlesReflectionEnabled(lua_State* L); int SetVolumeLightsEnabled(lua_State* L); int SetLightShaftsEnabled(lua_State* L); int SetLensFlareEnabled(lua_State* L); diff --git a/WickedEngine/wiBackLog.cpp b/WickedEngine/wiBackLog.cpp index e20185605..7649dfbe3 100644 --- a/WickedEngine/wiBackLog.cpp +++ b/WickedEngine/wiBackLog.cpp @@ -71,7 +71,7 @@ void wiBackLog::Draw(){ font.SetText(getText()); font.props.posY = pos - wiRenderer::RENDERHEIGHT + 75 + scroll; font.Draw(); - wiFont(inputArea.str().c_str(), wiFontProps(5, -(float)wiRenderer::RENDERHEIGHT + 10, 0, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw(); + wiFont(inputArea.str().c_str(), wiFontProps(5, -(float)wiRenderer::GetScreenHeight() + 10, 0, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw(); //wiFont::Draw(wiBackLog::getText(), "01", XMFLOAT4(5, pos - wiRenderer::RENDERHEIGHT + 75 + scroll, 0, -8), "left", "bottom"); //wiFont::Draw(inputArea.str().c_str(), "01", XMFLOAT4(5, -(float)wiRenderer::RENDERHEIGHT + 10, 0, -8), "left", "bottom"); } diff --git a/WickedEngine/wiImage.cpp b/WickedEngine/wiImage.cpp index 17b33d122..5332d2130 100644 --- a/WickedEngine/wiImage.cpp +++ b/WickedEngine/wiImage.cpp @@ -318,10 +318,10 @@ void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effect if(!effects.process.active && !effects.bloom.separate && !effects.sunPos.x && !effects.sunPos.y){ static thread_local ConstantBuffer* cb = new ConstantBuffer; if(effects.typeFlag==SCREEN){ - (*cb).mViewProjection = XMMatrixTranspose( wiRenderer::getCamera()->GetOProjection() ); - (*cb).mTrans = XMMatrixTranspose(XMMatrixTranslation(wiRenderer::RENDERWIDTH / 2 - effects.siz.x / 2, -wiRenderer::RENDERHEIGHT / 2 + effects.siz.y / 2, 0) * XMMatrixRotationZ(effects.rotation) - * XMMatrixTranslation(-wiRenderer::RENDERWIDTH / 2 + effects.pos.x + effects.siz.x*0.5f, wiRenderer::RENDERHEIGHT / 2 + effects.pos.y - effects.siz.y*0.5f, 0)); //AUTO ORIGIN CORRECTION APPLIED! NO FURTHER TRANSLATIONS NEEDED! - (*cb).mDimensions = XMFLOAT4((float)wiRenderer::RENDERWIDTH, (float)wiRenderer::RENDERHEIGHT, effects.siz.x, effects.siz.y); + (*cb).mViewProjection = XMMatrixTranspose(XMMatrixOrthographicLH((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight(), 0, 100)); + (*cb).mTrans = XMMatrixTranspose(XMMatrixTranslation(wiRenderer::GetScreenWidth() / 2 - effects.siz.x / 2, -wiRenderer::GetScreenHeight() / 2 + effects.siz.y / 2, 0) * XMMatrixRotationZ(effects.rotation) + * XMMatrixTranslation(-wiRenderer::GetScreenWidth() / 2 + effects.pos.x + effects.siz.x*0.5f, wiRenderer::GetScreenHeight() / 2 + effects.pos.y - effects.siz.y*0.5f, 0)); //AUTO ORIGIN CORRECTION APPLIED! NO FURTHER TRANSLATIONS NEEDED! + (*cb).mDimensions = XMFLOAT4((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight(), effects.siz.x, effects.siz.y); } else if(effects.typeFlag==WORLD){ (*cb).mViewProjection = XMMatrixTranspose( wiRenderer::getCamera()->GetView() * wiRenderer::getCamera()->GetProjection() ); @@ -454,7 +454,7 @@ void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effect if(effects.extractNormalMap==true) normalmapmode=2; (*pscb).mMaskFadOpaDis = XMFLOAT4((effects.maskMap ? 1.f : 0.f), effects.fade, effects.opacity, (float)normalmapmode); - (*pscb).mDimension = XMFLOAT4((float)wiRenderer::RENDERWIDTH, (float)wiRenderer::RENDERHEIGHT, effects.siz.x, effects.siz.y); + (*pscb).mDimension = XMFLOAT4((float)wiRenderer::GetScreenWidth(), (float)wiRenderer::GetScreenHeight(), effects.siz.x, effects.siz.y); wiRenderer::UpdateBuffer(PSCb,pscb,context); //PSConstantBuffer* dataPtr2; @@ -478,11 +478,11 @@ void wiImage::Draw(wiRenderer::TextureView texture, const wiImageEffects& effect static thread_local BlurBuffer* cb = new BlurBuffer; if(effects.blurDir==0){ wiRenderer::BindPS(blurHPS,context); - (*cb).mWeightTexelStrenMip.y = 1.0f / wiRenderer::RENDERWIDTH; + (*cb).mWeightTexelStrenMip.y = 1.0f / wiRenderer::GetRenderWidth(); } else{ wiRenderer::BindPS(blurVPS,context); - (*cb).mWeightTexelStrenMip.y = 1.0f / wiRenderer::RENDERHEIGHT; + (*cb).mWeightTexelStrenMip.y = 1.0f / wiRenderer::GetRenderHeight(); } float weight0 = 1.0f; diff --git a/WickedEngine/wiLoader.h b/WickedEngine/wiLoader.h index 9fce9ff79..0db9f226a 100644 --- a/WickedEngine/wiLoader.h +++ b/WickedEngine/wiLoader.h @@ -839,7 +839,7 @@ struct Wind{ Wind():direction(XMFLOAT3(0,0,0)),time(0),randomness(5),waveSize(1){} }; struct Camera:public Transform{ - XMFLOAT4X4 View, Projection, OProjection; + XMFLOAT4X4 View, Projection; XMFLOAT3 At, Up; float width, height; float zNearP, zFarP; @@ -857,7 +857,7 @@ struct Camera:public Transform{ } void SetUp(int newWidth, int newHeight, float newNear, float newFar) { - XMMATRIX View, Projection, OProjection; + XMMATRIX View, Projection; XMVECTOR At = XMVectorSet(0,0,1,0), Up = XMVectorSet(0,1,0,0), Eye = this->GetEye(); zNearP = newNear; @@ -868,12 +868,10 @@ struct Camera:public Transform{ Projection = XMMatrixPerspectiveFovLH(XM_PI / 3.0f, (float)width / (float)height, zNearP, zFarP); - OProjection = XMMatrixOrthographicLH((float)width, (float)height, 0.1f, 5000.0f); XMStoreFloat4x4(&this->View, View); XMStoreFloat4x4(&this->Projection, Projection); - XMStoreFloat4x4(&this->OProjection, OProjection); XMStoreFloat3(&this->At, At); XMStoreFloat3(&this->Up, Up); @@ -958,10 +956,6 @@ struct Camera:public Transform{ { return XMLoadFloat4x4(&Projection); } - XMMATRIX GetOProjection() - { - return XMLoadFloat4x4(&OProjection); - } XMMATRIX GetViewProjection() { return XMMatrixMultiply(GetView(),GetProjection());