From acc5c3bbbf3e59baf55c536e189394d36511da01 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 20 Jul 2012 17:08:15 +0200 Subject: [PATCH] some fixes --- apps/openmw/mwrender/sky.cpp | 15 ++++++++++++++- apps/openmw/mwrender/sky.hpp | 8 ++++++-- apps/openmw/mwworld/physicssystem.cpp | 11 +++++------ files/materials/atmosphere.shader | 2 -- files/materials/clouds.shader | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 25928cf3f..2a2df7943 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -57,6 +57,8 @@ BillboardObject::BillboardObject( const String& textureName, mMaterial = sh::Factory::getInstance().createMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount), material); mMaterial->setProperty("texture", sh::makeProperty(new sh::StringValue(textureName))); + sh::Factory::getInstance().getMaterialInstance ("BillboardMaterial"+StringConverter::toString(bodyCount))->setListener(this); + mBBSet->setMaterialName("BillboardMaterial"+StringConverter::toString(bodyCount)); bodyCount++; @@ -66,6 +68,16 @@ BillboardObject::BillboardObject() { } +void BillboardObject::requestedConfiguration (sh::MaterialInstance* m, const std::string& configuration) +{ +} + +void BillboardObject::createdConfiguration (sh::MaterialInstance* m, const std::string& configuration) +{ + setVisibility(mVisibility); + setColour(mColour); +} + void BillboardObject::setVisible(const bool visible) { mBBSet->setVisible(visible); @@ -78,6 +90,7 @@ void BillboardObject::setSize(const float size) void BillboardObject::setVisibility(const float visibility) { + mVisibility = visibility; Ogre::MaterialPtr m = static_cast(mMaterial->getMaterial ())->getOgreMaterial (); for (int i=0; igetNumTechniques(); ++i) { @@ -110,6 +123,7 @@ void BillboardObject::setVisibilityFlags(int flags) void BillboardObject::setColour(const ColourValue& pColour) { + mColour = pColour; Ogre::MaterialPtr m = static_cast(mMaterial->getMaterial ())->getOgreMaterial (); for (int i=0; igetNumTechniques(); ++i) { @@ -117,7 +131,6 @@ void BillboardObject::setColour(const ColourValue& pColour) if (t->getNumPasses ()) t->getPass(0)->setSelfIllumination (pColour); } - //mMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(pColour); } void BillboardObject::setRenderQueue(unsigned int id) diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index d785c6eb6..9fdff3a01 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -27,7 +27,7 @@ namespace Ogre namespace MWRender { - class BillboardObject + class BillboardObject : public sh::MaterialInstanceListener { public: BillboardObject( const Ogre::String& textureName, @@ -38,6 +38,9 @@ namespace MWRender ); BillboardObject(); + void requestedConfiguration (sh::MaterialInstance* m, const std::string& configuration); + void createdConfiguration (sh::MaterialInstance* m, const std::string& configuration); + virtual ~BillboardObject() {} void setColour(const Ogre::ColourValue& pColour); @@ -53,7 +56,8 @@ namespace MWRender Ogre::SceneNode* getNode(); protected: - + float mVisibility; + Ogre::ColourValue mColour; Ogre::SceneNode* mNode; sh::MaterialInstance* mMaterial; Ogre::BillboardSet* mBBSet; diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 105995aca..bf5c001db 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -181,16 +181,15 @@ namespace MWWorld playerphysics->ps.viewangles.y = yawQuat.getYaw().valueDegrees() *-1 + 90; - Ogre::Quaternion quat = yawNode->getOrientation(); - Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y); + Ogre::Vector3 dir1(iter->second.x,iter->second.z,-iter->second.y); - pm_ref.rightmove = -iter->second.x; - pm_ref.forwardmove = -iter->second.y; - pm_ref.upmove = iter->second.z; + pm_ref.rightmove = -iter->second.x; + pm_ref.forwardmove = -iter->second.y; + pm_ref.upmove = iter->second.z; - } + } diff --git a/files/materials/atmosphere.shader b/files/materials/atmosphere.shader index 6e22b7ac3..295fa9376 100644 --- a/files/materials/atmosphere.shader +++ b/files/materials/atmosphere.shader @@ -28,8 +28,6 @@ SH_START_PROGRAM { shOutputColour(0) = colourPassthrough * atmosphereColour; - - shOutputColour(0) = float3(0,0,0,1); #if MRT shOutputColour(1) = float4(1,1,1,1); diff --git a/files/materials/clouds.shader b/files/materials/clouds.shader index aa53e6051..7677ecd95 100644 --- a/files/materials/clouds.shader +++ b/files/materials/clouds.shader @@ -43,7 +43,7 @@ float4 albedo = shSample(diffuseMap1, scrolledUV) * (1-cloudBlendFactor) + shSample(diffuseMap2, scrolledUV) * cloudBlendFactor; shOutputColour(0) = colourPassthrough * float4(cloudColour, 1) * albedo * float4(1,1,1, cloudOpacity); - shOutputColour(0) = float3(0,0,0,1); + #if MRT shOutputColour(1) = float4(1,1,1,1); #endif