Re: SkyX plugin [SkyX 0.1 released! - Page 1]
Posted: Mon Jan 03, 2011 2:50 pm
it can be useful, skyx is for me the best sky manager, but low follow, and sky demo isn't self explain 
Support and community hang-out spot for Ogre3D
https://forums.ogre3d.org/
Code: Select all
17:23:33: DefaultWorkQueue('Root') initialising on thread 0021CF80.
17:23:33: Particle Renderer Type 'billboard' registered
17:23:33: SceneManagerFactory for type 'BspSceneManager' registered.
17:23:33: Registering ResourceManager for type BspLevel
17:23:33: SceneManagerFactory for type 'PCZSceneManager' registered.
17:23:33: MovableObjectFactory for type 'PCZLight' registered.
17:23:33: MovableObjectFactory for type 'Portal' registered.
17:23:33: MovableObjectFactory for type 'AntiPortal' registered.
17:23:33: PCZone Factory Type 'ZoneType_Octree' registered
17:23:33: PCZone Factory Type 'ZoneType_Terrain' registered
17:23:33: SceneManagerFactory for type 'OctreeSceneManager' registered.
17:23:33: SceneManagerFactory for type 'TerrainSceneManager' registered.
17:23:33: TerrainSceneManager: Registered a new PageSource for type Heightmap
17:23:33: Parsing scripts for resource group Autodetect
17:23:33: Finished parsing scripts for resource group Autodetect
17:23:33: Parsing scripts for resource group General
17:23:33: Finished parsing scripts for resource group General
17:23:33: Parsing scripts for resource group Internal
17:23:33: Finished parsing scripts for resource group Internal
17:23:33: Parsing scripts for resource group SkyX
17:23:33: Parsing script SkyX.material
17:23:33: DefaultWorkQueue('Root')::WorkerFunc - thread 002277E8 starting.
17:23:33: DefaultWorkQueue('Root')::WorkerFunc - thread 002277B8 starting.
17:23:33: Compiler error: invalid parameters in SkyX.material(109): param_named and param_indexed properties requires at least 3 arguments
17:23:35: Finished parsing scripts for resource group SkyX
17:23:35: *** Initializing OIS ***
17:23:35: Texture: core.png: Loading 1 faces(PF_A8R8G8B8,1024x256x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x256x1.
17:23:35: Texture: bc_core.png: Loading 1 faces(PF_A8R8G8B8,1024x768x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x768x1.
17:23:35: Texture: core_pointer.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
17:23:36: Texture: bc_interface.png: Loading 1 faces(PF_SHORT_RGBA,1280x1024x1) with 0 generated mipmaps from Image. Internal format is PF_SHORT_RGBA,1280x1024x1.
17:23:36: Texture: medal.png: Loading 1 faces(PF_A8R8G8B8,132x133x1) with 0 generated mipmaps from Image. Internal format is PF_A8R8G8B8,132x133x1.
17:23:36: Terrain created; size=2049 minBatch=33 maxBatch=65 treeDepth=6 lodLevels=7 leafLods=2
Code: Select all
/*
--------------------------------------------------------------------------------
This source file is part of SkyX.
Visit ---
Copyright (C) 2009 Xavier Verguín González <xavierverguin@hotmail.com>
<xavyiy@gmail.com>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
--------------------------------------------------------------------------------
*/
// ------------------------- SkyX clouds -----------------------------
vertex_program SkyX_Clouds_VP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_vp
target vs_1_1
default_params
{
param_named_auto uWorldViewProj worldviewproj_matrix
}
}
fragment_program SkyX_Clouds_LDR_FP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
}
}
fragment_program SkyX_Clouds_HDR_FP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
// ------------------------- SkyX volumetric clouds ------------------
vertex_program SkyX_VolClouds_VP hlsl
{
source SkyX_VolClouds.hlsl
entry_point main_vp
target vs_1_1
default_params
{
}
}
fragment_program SkyX_VolClouds_FP hlsl
{
source SkyX_VolClouds.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_VolClouds
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write on
depth_check on
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater 0
vertex_program_ref SkyX_VolClouds_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uCameraPosition camera_position_object_space
param_named uRadius 30000
}
fragment_program_ref SkyX_VolClouds_FP
{
param_named uInterpolation float 0
param_named uSunDirection float3 0 1 0
param_named uSunColor float3 1 1 1
param_named uAmbientColor float3 0.63 0.63 0.7
param_named uLightResponse float4 0.25 0.2 1 0.1
param_named uAmbientFactors float4 0.4 1 1 1
}
texture_unit Density0
{
tex_address_mode wrap
tex_coord_set 0
}
texture_unit Density1
{
tex_address_mode wrap
tex_coord_set 1
}
texture_unit Noise
{
tex_address_mode wrap
tex_coord_set 2
texture Noise.jpg
}
}
}
}
// --------------------- SkyX skydome material ------------------------
vertex_program SkyX_Skydome_VP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_vp
target vs_2_0
default_params
{
}
}
fragment_program SkyX_Skydome_STARFIELD_LDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR,STARFIELD
default_params
{
}
}
fragment_program SkyX_Skydome_STARFIELD_HDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines STARFIELD
default_params
{
}
}
fragment_program SkyX_Skydome_LDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
}
}
fragment_program SkyX_Skydome_HDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_Skydome_STARFIELD_LDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_STARFIELD_LDR_FP
{
param_named uTime float 0
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
param_named uExposure float 1.75
}
texture_unit Starfield
{
texture SkyX_Starfield.png
tex_address_mode wrap
filtering linear linear none
tex_coord_set 0
}
}
}
}
material SkyX_Skydome_STARFIELD_HDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_STARFIELD_HDR_FP
{
param_named uTime float 0
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
}
texture_unit Starfield
{
texture SkyX_Starfield.png
tex_address_mode wrap
filtering linear linear none
tex_coord_set 0
}
}
}
}
material SkyX_Skydome_LDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_LDR_FP
{
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
param_named uExposure float 1.75
}
}
}
}
material SkyX_Skydome_HDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_HDR_FP
{
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
}
}
}
}
// --------------------- SkyX moon material ------------------------
vertex_program SkyX_Moon_VP hlsl
{
source SkyX_Moon.hlsl
entry_point main_vp
target vs_1_1
default_params
{
}
}
fragment_program SkyX_Moon_FP hlsl
{
source SkyX_Moon.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_Moon
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Moon_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uWorld world_matrix
param_named uSkydomeCenter float3 0 0 0
}
fragment_program_ref SkyX_Moon_FP
{
}
texture_unit Moon
{
texture SkyX_Moon.png
tex_address_mode clamp
// filtering linear linear none
tex_coord_set 0
}
}
}
}
// --------------------- SkyX ground material ------------------------
vertex_program SkyX_Ground_VP hlsl
{
source SkyX_Ground.hlsl
entry_point main_vp
target vs_2_0
default_params
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uWorld world_matrix
param_named_auto uCameraPos_ camera_position
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 1 0 0
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uSkydomeRadius float 2850
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
}
fragment_program SkyX_Ground_LDR_FP hlsl
{
source SkyX_Ground.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
param_named uExposure float 1.75
}
}
fragment_program SkyX_Ground_HDR_FP hlsl
{
source SkyX_Ground.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}Code: Select all
vertex_program_ref SkyX_VolClouds_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uCameraPosition camera_position_object_space
// now it should work
param_named uRadius float 30000
}
Code: Select all
void BCClient::createScene(void)
{
createlight();
terrain_init();
SkyX::SkyX* mSkyX = new SkyX::SkyX(mSceneMgr, mCamera);
sky_init(mRoot,mSceneMgr,mWindow,mCamera);
}Code: Select all
class SkyXFrameListener : public Ogre::FrameListener
{
public:
Ogre::SceneManager *mSceneMgr;
Ogre::Real mKeyBuffer;
Ogre::RenderWindow* mWindow;
Ogre::Camera* mCamera;
Ogre::SceneManager *sm;
SkyX::SkyX* mSkyX;
SkyXFrameListener(Ogre::RenderWindow* mWindow, Ogre::Camera* mCamera, Ogre::SceneManager *mSceneMgr)
: Ogre::FrameListener()
, mSceneMgr(sm)
, mKeyBuffer(-1)
{
}
bool frameStarted(const Ogre::FrameEvent &e)
{
// Check camera height
if (mCamera->getDerivedPosition().y < 275)
{
mCamera->setPosition(Ogre::Vector3(mCamera->getDerivedPosition().x, 275, mCamera->getDerivedPosition().z));
}
else if (mCamera->getDerivedPosition().y > 1000)
{
mCamera->setPosition(Ogre::Vector3(mCamera->getDerivedPosition().x, 1000, mCamera->getDerivedPosition().z));
}
SkyX::AtmosphereManager::Options SkyXOptions = mSkyX->getAtmosphereManager()->getOptions();
// Time
mSkyX->setTimeMultiplier(0.1f);
// diminuisci il tempo if (mKeyboard->isKeyDown(OIS::KC_1) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->setTimeMultiplier(1.0f);
// aumenta il tempo if (mKeyboard->isKeyDown(OIS::KC_1) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->setTimeMultiplier(-1.0f);
// Rayleigh multiplier
//if (mKeyboard->isKeyDown(OIS::KC_2) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.RayleighMultiplier += e.timeSinceLastFrame*0.025f;
//if (mKeyboard->isKeyDown(OIS::KC_2) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.RayleighMultiplier -= e.timeSinceLastFrame*0.025f;
// Mie multiplier
//if (mKeyboard->isKeyDown(OIS::KC_3) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.MieMultiplier += e.timeSinceLastFrame*0.025f;
//if (mKeyboard->isKeyDown(OIS::KC_3) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.MieMultiplier -= e.timeSinceLastFrame*0.025f;
// Exposure
//if (mKeyboard->isKeyDown(OIS::KC_4) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.Exposure += e.timeSinceLastFrame*0.5f;
//if (mKeyboard->isKeyDown(OIS::KC_4) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.Exposure -= e.timeSinceLastFrame*0.5f;
// Inner radius
//if (mKeyboard->isKeyDown(OIS::KC_5) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.InnerRadius += e.timeSinceLastFrame*0.25f;
//if (mKeyboard->isKeyDown(OIS::KC_5) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.InnerRadius -= e.timeSinceLastFrame*0.25f;
// Outer radius
//if (mKeyboard->isKeyDown(OIS::KC_6) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.OuterRadius += e.timeSinceLastFrame*0.25f;
//if (mKeyboard->isKeyDown(OIS::KC_6) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) SkyXOptions.OuterRadius -= e.timeSinceLastFrame*0.25f;
// Number of samples
/*if (mKeyboard->isKeyDown(OIS::KC_7) && mKeyBuffer < 0 &&!(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
{
SkyXOptions.NumberOfSamples ++;
mKeyBuffer = 0.25f;
}
if (mKeyboard->isKeyDown(OIS::KC_7) && mKeyBuffer < 0 && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
{
SkyXOptions.NumberOfSamples --;
mKeyBuffer = 0.25f;
}
*/
// Height position
/*
if (mKeyboard->isKeyDown(OIS::KC_8) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.HeightPosition += e.timeSinceLastFrame*0.05f;
if (mKeyboard->isKeyDown(OIS::KC_8) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.HeightPosition -= e.timeSinceLastFrame*0.05f;
*/
mSkyX->getAtmosphereManager()->setOptions(SkyXOptions);
// Wind speed
//if (mKeyboard->isKeyDown(OIS::KC_9) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->setWindSpeed(mSkyX->getVCloudsManager()->getWindSpeed() + 100.0f*e.timeSinceLastFrame);
//if (mKeyboard->isKeyDown(OIS::KC_9) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->setWindSpeed(mSkyX->getVCloudsManager()->getWindSpeed() - 100.0f*e.timeSinceLastFrame);
// Wind direction
//if (mKeyboard->isKeyDown(OIS::KC_0) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->getVClouds()->setWindDirection(Ogre::Radian(mSkyX->getVCloudsManager()->getVClouds()->getWindDirection().valueRadians() + 5.0f*e.timeSinceLastFrame));
//if (mKeyboard->isKeyDown(OIS::KC_0) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->getVClouds()->setWindDirection(Ogre::Radian(mSkyX->getVCloudsManager()->getVClouds()->getWindDirection().valueRadians() - 5.0f*e.timeSinceLastFrame));
if (mSkyX->getVCloudsManager()->getVClouds()->getWindDirection().valueDegrees() < 0)
{
mSkyX->getVCloudsManager()->getVClouds()->setWindDirection(Ogre::Degree(0));
}
if (mSkyX->getVCloudsManager()->getVClouds()->getWindDirection().valueDegrees() > 360)
{
mSkyX->getVCloudsManager()->getVClouds()->setWindDirection(Ogre::Degree(360));
}
// Roughness
//if (mKeyboard->isKeyDown(OIS::KC_P) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->getVClouds()->setNoiseScale(mSkyX->getVCloudsManager()->getVClouds()->getNoiseScale()+2.5f*e.timeSinceLastFrame);
//if (mKeyboard->isKeyDown(OIS::KC_P) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT))) mSkyX->getVCloudsManager()->getVClouds()->setNoiseScale(mSkyX->getVCloudsManager()->getVClouds()->getNoiseScale()-2.5f*e.timeSinceLastFrame);
mSkyX->update(e.timeSinceLastFrame);
mKeyBuffer -= e.timeSinceLastFrame;
return true;
}
};
Code: Select all
void sky_init(Ogre::Root *mRoot,Ogre::SceneManager* mSceneMgr,Ogre::RenderWindow* mWindow,Ogre::Camera* mCamera)
{
// Create SkyX
SkyX::SkyX* mSkyX;
mSkyX->create();
// Volumetric clouds
mSkyX->getVCloudsManager()->create();
// A little change to default atmosphere settings :)
SkyX::AtmosphereManager::Options atOpt = mSkyX->getAtmosphereManager()->getOptions();
atOpt.RayleighMultiplier = 0.0045f;
mSkyX->getAtmosphereManager()->setOptions(atOpt);
// Add frame listener
mRoot->addFrameListener(new SkyXFrameListener(mWindow, mCamera, mSceneMgr));
}
Code: Select all
/*
--------------------------------------------------------------------------------
This source file is part of SkyX.
Visit ---
Copyright (C) 2009 Xavier Verguín González <xavierverguin@hotmail.com>
<xavyiy@gmail.com>
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt.
--------------------------------------------------------------------------------
*/
// ------------------------- SkyX clouds -----------------------------
vertex_program SkyX_Clouds_VP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_vp
target vs_1_1
default_params
{
param_named_auto uWorldViewProj worldviewproj_matrix
}
}
fragment_program SkyX_Clouds_LDR_FP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
}
}
fragment_program SkyX_Clouds_HDR_FP hlsl
{
source SkyX_Clouds.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
// ------------------------- SkyX volumetric clouds ------------------
vertex_program SkyX_VolClouds_VP hlsl
{
source SkyX_VolClouds.hlsl
entry_point main_vp
target vs_1_1
default_params
{
}
}
fragment_program SkyX_VolClouds_FP hlsl
{
source SkyX_VolClouds.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_VolClouds
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write on
depth_check on
cull_hardware none
cull_software none
scene_blend alpha_blend
alpha_rejection greater 0
vertex_program_ref SkyX_VolClouds_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uCameraPosition camera_position_object_space
param_named uRadius float 30000
}
fragment_program_ref SkyX_VolClouds_FP
{
param_named uInterpolation float 0
param_named uSunDirection float3 0 1 0
param_named uSunColor float3 1 1 1
param_named uAmbientColor float3 0.63 0.63 0.7
param_named uLightResponse float4 0.25 0.2 1 0.1
param_named uAmbientFactors float4 0.4 1 1 1
}
texture_unit Density0
{
tex_address_mode wrap
tex_coord_set 0
}
texture_unit Density1
{
tex_address_mode wrap
tex_coord_set 1
}
texture_unit Noise
{
tex_address_mode wrap
tex_coord_set 2
texture Noise.jpg
}
}
}
}
// --------------------- SkyX skydome material ------------------------
vertex_program SkyX_Skydome_VP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_vp
target vs_2_0
default_params
{
}
}
fragment_program SkyX_Skydome_STARFIELD_LDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR,STARFIELD
default_params
{
}
}
fragment_program SkyX_Skydome_STARFIELD_HDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines STARFIELD
default_params
{
}
}
fragment_program SkyX_Skydome_LDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
}
}
fragment_program SkyX_Skydome_HDR_FP hlsl
{
source SkyX_Skydome.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_Skydome_STARFIELD_LDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_STARFIELD_LDR_FP
{
param_named uTime float 0
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
param_named uExposure float 1.75
}
texture_unit Starfield
{
texture SkyX_Starfield.png
tex_address_mode wrap
filtering linear linear none
tex_coord_set 0
}
}
}
}
material SkyX_Skydome_STARFIELD_HDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_STARFIELD_HDR_FP
{
param_named uTime float 0
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
}
texture_unit Starfield
{
texture SkyX_Starfield.png
tex_address_mode wrap
filtering linear linear none
tex_coord_set 0
}
}
}
}
material SkyX_Skydome_LDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_LDR_FP
{
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
param_named uExposure float 1.75
}
}
}
}
material SkyX_Skydome_HDR
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Skydome_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 0 0 1
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKmESun float 0.350000002
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
fragment_program_ref SkyX_Skydome_HDR_FP
{
// Must be the same as in the vertex program, normalized
param_named uLightDir float3 0 0 1
param_named uG float -0.991
param_named uG2 float 0.982081
}
}
}
}
// --------------------- SkyX moon material ------------------------
vertex_program SkyX_Moon_VP hlsl
{
source SkyX_Moon.hlsl
entry_point main_vp
target vs_1_1
default_params
{
}
}
fragment_program SkyX_Moon_FP hlsl
{
source SkyX_Moon.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}
material SkyX_Moon
{
receive_shadows off
technique
{
pass
{
lighting off
depth_write off
depth_check off
scene_blend alpha_blend
vertex_program_ref SkyX_Moon_VP
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uWorld world_matrix
param_named uSkydomeCenter float3 0 0 0
}
fragment_program_ref SkyX_Moon_FP
{
}
texture_unit Moon
{
texture SkyX_Moon.png
tex_address_mode clamp
// filtering linear linear none
tex_coord_set 0
}
}
}
}
// --------------------- SkyX ground material ------------------------
vertex_program SkyX_Ground_VP hlsl
{
source SkyX_Ground.hlsl
entry_point main_vp
target vs_2_0
default_params
{
param_named_auto uWorldViewProj worldviewproj_matrix
param_named_auto uWorld world_matrix
param_named_auto uCameraPos_ camera_position
// Must be the same as in the fragment program, normalized
param_named uLightDir float3 1 0 0
// Camera position
param_named uCameraPos float3 0 1.0001 0
// Inverse wave length (RGB: 570 nm, 540 nm and 440 nm, respectively) -> 1 / pow (0.57, 4); etc.
param_named uInvWaveLength float3 9.473284438 11.76047764 26.6802131
// Inner radius
param_named uInnerRadius float 1
param_named uKrESun float 0.32299994
param_named uKr4PI float 0.0850
param_named uKm4PI float 0.2008849557
// 1 / (OuterRadius-InnerRadius)
param_named uScale float 4
// (OuterRadius - InnerRadius) / 2.0f
param_named uScaleDepth float 0.125
// Scale / ScaleDepth;
param_named uScaleOverScaleDepth float 32
param_named uSkydomeRadius float 2850
param_named uNumberOfSamples int 6
param_named uSamples float 6
}
}
fragment_program SkyX_Ground_LDR_FP hlsl
{
source SkyX_Ground.hlsl
entry_point main_fp
target ps_2_0
preprocessor_defines LDR
default_params
{
param_named uExposure float 1.75
}
}
fragment_program SkyX_Ground_HDR_FP hlsl
{
source SkyX_Ground.hlsl
entry_point main_fp
target ps_2_0
default_params
{
}
}Code: Select all
21:31:10: Can't assign material _NULL_ to SubEntity of SkyXMeshEnt because this Material does not exist. Have you forgotten to define it in a .material script?
21:31:10: Texture: SkyX_Starfield.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
21:31:10: Texture: SkyX_Moon.png: Loading 1 faces(PF_A8R8G8B8,512x512x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,512x512x1.
Did anybody get these to work with the SkyX demos? I copied the media folder with the GLSL shaders into Xavyiy's SkyX demo folder. Now the demos start without crash but none of the shaders seem to work. I replaced all saturate calls with clamp and lerp with mix. Still I see no clouds and the terrain has no texture on it. Do I have to do something else? Do I need to use a different version of SkyX for it to work?hatboyzero wrote:Ok, first cut of the cmake project + GLSL shaders is available at
http://www.matthewalangray.com/SkyX.zip
I had some difficulty getting the GLSL preprocessor statements to work, and I can't figure out why the lighting is off in the volumetric cloud demo for the absolute life of me, but otherwise, it works using OpenGL in a windows environment. I will try to make time to test it in a Linux environment this evening.
Also, when I get time to sit down and test things in a proper manner, I'll tidy up the shader code as well
nevarim wrote:question for all
anyone found way to use skyx with ogre 1.7 (also in executable, my code is ok but when i launch demo or other program i find out problem on material file)?
Nevarim
Code: Select all
19:37:21: Creating resource group General
19:37:21: Creating resource group Internal
19:37:21: Creating resource group Autodetect
19:37:21: SceneManagerFactory for type 'DefaultSceneManager' registered.
19:37:21: Registering ResourceManager for type Material
19:37:21: Registering ResourceManager for type Mesh
19:37:21: Registering ResourceManager for type Skeleton
19:37:21: MovableObjectFactory for type 'ParticleSystem' registered.
19:37:21: OverlayElementFactory for type Panel registered.
19:37:21: OverlayElementFactory for type BorderPanel registered.
19:37:21: OverlayElementFactory for type TextArea registered.
19:37:21: Registering ResourceManager for type Font
19:37:21: ArchiveFactory for archive type FileSystem registered.
19:37:21: ArchiveFactory for archive type Zip registered.
19:37:21: DDS codec registering
19:37:21: FreeImage version: 3.13.1
19:37:21: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
19:37:21: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic,bay,bmq,cr2,crw,cs1,dc2,dcr,dng,erf,fff,hdr,k25,kdc,mdc,mos,mrw,nef,orf,pef,pxn,raf,raw,rdc,sr2,srf,arw,3fr,cine,ia,kc2,mef,nrw,qtk,rw2,sti,drf,dsc,ptx,cap,iiq,rwz
19:37:21: Registering ResourceManager for type HighLevelGpuProgram
19:37:21: Registering ResourceManager for type Compositor
19:37:21: MovableObjectFactory for type 'Entity' registered.
19:37:21: MovableObjectFactory for type 'Light' registered.
19:37:21: MovableObjectFactory for type 'BillboardSet' registered.
19:37:21: MovableObjectFactory for type 'ManualObject' registered.
19:37:21: MovableObjectFactory for type 'BillboardChain' registered.
19:37:21: MovableObjectFactory for type 'RibbonTrail' registered.
19:37:21: Loading library .\RenderSystem_Direct3D9
19:37:21: Installing plugin: D3D9 RenderSystem
19:37:21: D3D9 : Direct3D9 Rendering Subsystem created.
19:37:21: D3D9: Driver Detection Starts
19:37:21: D3D9: Driver Detection Ends
19:37:21: Plugin successfully installed
19:37:21: Loading library .\RenderSystem_GL
19:37:21: Installing plugin: GL RenderSystem
19:37:21: OpenGL Rendering Subsystem created.
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_ParticleFX
19:37:22: Installing plugin: ParticleFX
19:37:22: Particle Emitter Type 'Point' registered
19:37:22: Particle Emitter Type 'Box' registered
19:37:22: Particle Emitter Type 'Ellipsoid' registered
19:37:22: Particle Emitter Type 'Cylinder' registered
19:37:22: Particle Emitter Type 'Ring' registered
19:37:22: Particle Emitter Type 'HollowEllipsoid' registered
19:37:22: Particle Affector Type 'LinearForce' registered
19:37:22: Particle Affector Type 'ColourFader' registered
19:37:22: Particle Affector Type 'ColourFader2' registered
19:37:22: Particle Affector Type 'ColourImage' registered
19:37:22: Particle Affector Type 'ColourInterpolator' registered
19:37:22: Particle Affector Type 'Scaler' registered
19:37:22: Particle Affector Type 'Rotator' registered
19:37:22: Particle Affector Type 'DirectionRandomiser' registered
19:37:22: Particle Affector Type 'DeflectorPlane' registered
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_BSPSceneManager
19:37:22: Installing plugin: BSP Scene Manager
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_CgProgramManager
19:37:22: Installing plugin: Cg Program Manager
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_PCZSceneManager
19:37:22: Installing plugin: Portal Connected Zone Scene Manager
19:37:22: PCZone Factory Type 'ZoneType_Default' registered
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_OctreeZone
19:37:22: Installing plugin: Octree Zone Factory
19:37:22: Plugin successfully installed
19:37:22: Loading library .\Plugin_OctreeSceneManager
19:37:22: Installing plugin: Octree & Terrain Scene Manager
19:37:22: Plugin successfully installed
19:37:22: *-*-* OGRE Initialising
19:37:22: *-*-* Version 1.7.2 (Cthugha)
19:37:22: Added resource location 'media' of type 'FileSystem' to resource group 'General'
19:37:22: Added resource location 'ifc' of type 'FileSystem' to resource group 'General'
19:37:22: Added resource location 'media/texture' of type 'FileSystem' to resource group 'General'
19:37:22: Creating resource group Hydrax
19:37:22: Added resource location 'media/Hydrax' of type 'FileSystem' to resource group 'Hydrax'
19:37:22: Creating resource group SkyX
19:37:22: Added resource location 'media/SkyX' of type 'FileSystem' to resource group 'SkyX'
19:37:22: D3D9 : RenderSystem Option: Allow NVPerfHUD = No
19:37:22: D3D9 : RenderSystem Option: FSAA = 0
19:37:22: D3D9 : RenderSystem Option: Floating-point mode = Fastest
19:37:22: D3D9 : RenderSystem Option: Full Screen = Yes
19:37:22: D3D9 : RenderSystem Option: Rendering Device = Monitor-1-ATI Mobility Radeon HD 5470
19:37:22: D3D9 : RenderSystem Option: Resource Creation Policy = Create on all devices
19:37:22: D3D9 : RenderSystem Option: VSync = No
19:37:22: D3D9 : RenderSystem Option: VSync Interval = 1
19:37:22: D3D9 : RenderSystem Option: Video Mode = 1366 x 768 @ 32-bit colour
19:37:22: D3D9 : RenderSystem Option: sRGB Gamma Conversion = No
19:37:23: CPU Identifier & Features
19:37:23: -------------------------
19:37:23: * CPU ID: AuthenticAMD: AMD Athlon(tm) II P340 Dual-Core Processor
19:37:23: * SSE: yes
19:37:23: * SSE2: yes
19:37:23: * SSE3: yes
19:37:23: * MMX: yes
19:37:23: * MMXEXT: yes
19:37:23: * 3DNOW: yes
19:37:23: * 3DNOWEXT: yes
19:37:23: * CMOV: yes
19:37:23: * TSC: yes
19:37:23: * FPU: yes
19:37:23: * PRO: yes
19:37:23: * HT: no
19:37:23: -------------------------
19:37:23: *** Starting Win32GL Subsystem ***
19:37:23: GLRenderSystem::_createRenderWindow "BCClient Render Window", 1366x768 fullscreen miscParams: FSAA=4 FSAAHint= colourDepth=32 displayFrequency=60 gamma=false vsync=true vsyncInterval=1
19:37:23: Created Win32Window 'BCClient Render Window' : 1366x768, 32bpp
19:37:24: GL_VERSION = 3.2.9712 Compatibility Profile Context
19:37:24: GL_VENDOR = ATI Technologies Inc.
19:37:24: GL_RENDERER = ATI Mobility Radeon HD 5470
19:37:24: GL_EXTENSIONS = GL_AMDX_name_gen_delete GL_AMDX_random_access_target GL_AMDX_vertex_shader_tessellator GL_AMD_draw_buffers_blend GL_AMD_performance_monitor GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_stencil_export GL_AMD_texture_cube_map_array GL_AMD_texture_texture4 GL_AMD_vertex_shader_tessellator GL_ARB_color_buffer_float GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex GL_ARB_sample_shading GL_ARB_seamless_cube_map GL_ARB_shader_objects GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shadow GL_ARB_shadow_ambient GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_snorm GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_envmap_bumpmap GL_ATI_fragment_shader GL_ATI_meminfo GL_ATI_separate_stencil GL_ATI_texture_compression_3dc GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_ATI_texture_mirror_once GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_copy_buffer GL_EXT_copy_texture GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_histogram GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_specular_color GL_EXT_shader_atomic_counters GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_EXT_subtexture GL_EXT_texgen_reflection GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_buffer_object_rgb32 GL_EXT_texture_compression_bptc GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_add GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_blend_square GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_explicit_multisample GL_NV_primitive_restart GL_NV_texgen_reflection GL_SGIS_generate_mipmap GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_SUN_multi_draw_arrays GL_WIN_swap_hint WGL_EXT_swap_control
19:37:24: Supported WGL extensions: WGL_ARB_extensions_string WGL_ARB_pixel_format WGL_ATI_pixel_format_float WGL_ARB_pixel_format_float WGL_ARB_multisample WGL_EXT_swap_control WGL_ARB_pbuffer WGL_ARB_render_texture WGL_ARB_make_current_read WGL_EXT_extensions_string WGL_ARB_buffer_region WGL_EXT_framebuffer_sRGB WGL_ATI_render_texture_rectangle WGL_EXT_pixel_format_packed_float WGL_I3D_genlock WGL_NV_swap_group WGL_ARB_create_context WGL_AMD_gpu_association WGL_AMDX_gpu_association WGL_ARB_create_context_profile
19:37:24: ***************************
19:37:24: *** GL Renderer Started ***
19:37:24: ***************************
19:37:24: Registering ResourceManager for type GpuProgram
19:37:24: GLSL support detected
19:37:24: GL: Using GL_EXT_framebuffer_object for rendering to textures (best)
19:37:24: FBO PF_UNKNOWN depth/stencil support: D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_L8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_L16 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A4L4 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_BYTE_LA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_R5G6B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_B5G6R5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A4R4G4B4 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A1R5G5B5 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A2R10G10B10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_A2B10G10R10 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT16_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT16_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT32_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT32_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_X8B8G8R8 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_SHORT_RGBA depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_R3G3B2 depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT16_R depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT32_R depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_SHORT_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT16_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_FLOAT32_GR depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: FBO PF_SHORT_RGB depth/stencil support: D0S0 D0S1 D0S4 D0S8 D0S16 D16S0 D24S0 D32S0 Packed-D24S8
19:37:24: [GL] : Valid FBO targets PF_UNKNOWN PF_L8 PF_L16 PF_A8 PF_A4L4 PF_BYTE_LA PF_R5G6B5 PF_B5G6R5 PF_A4R4G4B4 PF_A1R5G5B5 PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_A2R10G10B10 PF_A2B10G10R10 PF_FLOAT16_RGB PF_FLOAT16_RGBA PF_FLOAT32_RGB PF_FLOAT32_RGBA PF_X8R8G8B8 PF_X8B8G8R8 PF_SHORT_RGBA PF_R3G3B2 PF_FLOAT16_R PF_FLOAT32_R PF_SHORT_GR PF_FLOAT16_GR PF_FLOAT32_GR PF_SHORT_RGB
19:37:24: RenderSystem capabilities
19:37:24: -------------------------
19:37:24: RenderSystem Name: OpenGL Rendering Subsystem
19:37:24: GPU Vendor: ati
19:37:24: Device Name: ATI Mobility Radeon HD 5470
19:37:24: Driver Version: 3.2.9712.0
19:37:24: * Fixed function pipeline: yes
19:37:24: * Hardware generation of mipmaps: yes
19:37:24: * Texture blending: yes
19:37:24: * Anisotropic texture filtering: yes
19:37:24: * Dot product texture operation: yes
19:37:24: * Cube mapping: yes
19:37:24: * Hardware stencil buffer: yes
19:37:24: - Stencil depth: 8
19:37:24: - Two sided stencil support: yes
19:37:24: - Wrap stencil values: yes
19:37:24: * Hardware vertex / index buffers: yes
19:37:24: * Vertex programs: yes
19:37:24: * Number of floating-point constants for vertex programs: 512
19:37:24: * Number of integer constants for vertex programs: 0
19:37:24: * Number of boolean constants for vertex programs: 0
19:37:24: * Fragment programs: yes
19:37:24: * Number of floating-point constants for fragment programs: 512
19:37:24: * Number of integer constants for fragment programs: 0
19:37:24: * Number of boolean constants for fragment programs: 0
19:37:24: * Geometry programs: yes
19:37:24: * Number of floating-point constants for geometry programs: 512
19:37:24: * Number of integer constants for geometry programs: 0
19:37:24: * Number of boolean constants for geometry programs: 0
19:37:24: * Supported Shader Profiles: arbfp1 arbvp1 glsl gp4gp gpu_gp nvgp4 ps_1_1 ps_1_2 ps_1_3 ps_1_4
19:37:24: * Texture Compression: yes
19:37:24: - DXT: yes
19:37:24: - VTC: no
19:37:24: - PVRTC: no
19:37:24: * Scissor Rectangle: yes
19:37:24: * Hardware Occlusion Query: yes
19:37:24: * User clip planes: yes
19:37:24: * VET_UBYTE4 vertex element type: yes
19:37:24: * Infinite far plane projection: yes
19:37:24: * Hardware render-to-texture: yes
19:37:24: * Floating point textures: yes
19:37:24: * Non-power-of-two textures: yes
19:37:24: * Volume textures: yes
19:37:24: * Multiple Render Targets: 8
19:37:24: - With different bit depths: yes
19:37:24: * Point Sprites: yes
19:37:24: * Extended point parameters: yes
19:37:24: * Max Point Size: 8192
19:37:24: * Vertex texture fetch: yes
19:37:24: * Number of world matrices: 0
19:37:24: * Number of texture units: 16
19:37:24: * Stencil buffer depth: 8
19:37:24: * Number of vertex blend matrices: 0
19:37:24: - Max vertex textures: 16
19:37:24: - Vertex textures shared: yes
19:37:24: * Render to Vertex Buffer : no
19:37:24: * GL 1.5 without VBO workaround: no
19:37:24: * Frame Buffer objects: yes
19:37:24: * Frame Buffer objects (ARB extension): no
19:37:24: * Frame Buffer objects (ATI extension): no
19:37:24: * PBuffer support: yes
19:37:24: * GL 1.5 without HW-occlusion workaround: no
19:37:24: Registering ResourceManager for type Texture
19:37:24: Using FSAA from GL_ARB_multisample extension.
19:37:24: DefaultWorkQueue('Root') initialising on thread 002A5CC8.
19:37:24: DefaultWorkQueue('Root')::WorkerFunc - thread 002B96E8 starting.
19:37:24: Particle Renderer Type 'billboard' registered
19:37:24: SceneManagerFactory for type 'BspSceneManager' registered.
19:37:24: Registering ResourceManager for type BspLevel
19:37:24: SceneManagerFactory for type 'PCZSceneManager' registered.
19:37:24: MovableObjectFactory for type 'PCZLight' registered.
19:37:24: MovableObjectFactory for type 'Portal' registered.
19:37:24: MovableObjectFactory for type 'AntiPortal' registered.
19:37:24: PCZone Factory Type 'ZoneType_Octree' registered
19:37:24: PCZone Factory Type 'ZoneType_Terrain' registered
19:37:24: SceneManagerFactory for type 'OctreeSceneManager' registered.
19:37:24: SceneManagerFactory for type 'TerrainSceneManager' registered.
19:37:24: DefaultWorkQueue('Root')::WorkerFunc - thread 002B9718 starting.
19:37:24: TerrainSceneManager: Registered a new PageSource for type Heightmap
19:37:24: Parsing scripts for resource group Autodetect
19:37:24: Finished parsing scripts for resource group Autodetect
19:37:24: Parsing scripts for resource group General
19:37:24: Finished parsing scripts for resource group General
19:37:24: Parsing scripts for resource group Hydrax
19:37:24: Finished parsing scripts for resource group Hydrax
19:37:24: Parsing scripts for resource group Internal
19:37:24: Finished parsing scripts for resource group Internal
19:37:24: Parsing scripts for resource group SkyX
19:37:24: Parsing script SkyX.material
19:37:24: Parsing script SkyXw.material
19:37:24: Finished parsing scripts for resource group SkyX
19:37:24: *** Initializing OIS ***
19:37:24: Texture: core.png: Loading 1 faces(PF_A8R8G8B8,1024x256x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1024x256x1.
19:37:24: Texture: bc_core.png: Loading 1 faces(PF_A8R8G8B8,1280x1024x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,1280x1024x1.
19:37:24: Texture: core_pointer.png: Loading 1 faces(PF_A8R8G8B8,256x128x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x128x1.
19:37:25: Texture: bc_interface.png: Loading 1 faces(PF_SHORT_RGBA,1280x1024x1) with hardware generated mipmaps from Image. Internal format is PF_SHORT_RGBA,1280x1024x1.
19:37:25: Texture: medal.png: Loading 1 faces(PF_A8R8G8B8,132x133x1) with hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,132x133x1.
19:37:25: Terrain created; size=4097 minBatch=33 maxBatch=65 treeDepth=7 lodLevels=8 leafLods=2
19:37:38: [Hydrax] Hydrax created.
19:37:38: [Hydrax] HydraxDemo.hdx loaded.
19:37:38: OGRE EXCEPTION(2:InvalidParametersException): Named constants have not been initialised, perhaps a compile error. in GpuProgramParameters::_findNamedConstantDefinition at ..\..\..\..\OgreMain\src\OgreGpuProgramParams.cpp (line 1423)
19:38:56: DefaultWorkQueue('Root') shutting down on thread 002A5CC8.
19:38:56: DefaultWorkQueue('Root')::WorkerFunc - thread 002B96E8 stopped.
19:38:56: DefaultWorkQueue('Root')::WorkerFunc - thread 002B9718 stopped.
19:38:56: PCZone Factory Type 'ZoneType_Octree' unregistered
19:38:56: PCZone Factory Type 'ZoneType_Terrain' unregistered
19:38:56: Unregistering ResourceManager for type BspLevel
19:38:56: *-*-* OGRE Shutdown
19:38:56: Unregistering ResourceManager for type Compositor
19:38:56: Unregistering ResourceManager for type Font
19:38:56: Unregistering ResourceManager for type Skeleton
19:38:56: Unregistering ResourceManager for type Mesh
19:38:56: Unregistering ResourceManager for type HighLevelGpuProgram
19:38:56: Uninstalling plugin: Octree & Terrain Scene Manager
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_OctreeSceneManager
19:38:56: Uninstalling plugin: Octree Zone Factory
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_OctreeZone
19:38:56: Uninstalling plugin: Portal Connected Zone Scene Manager
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_PCZSceneManager
19:38:56: Uninstalling plugin: Cg Program Manager
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_CgProgramManager
19:38:56: Uninstalling plugin: BSP Scene Manager
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_BSPSceneManager
19:38:56: Uninstalling plugin: ParticleFX
19:38:56: Plugin successfully uninstalled
19:38:56: Unloading library .\Plugin_ParticleFX
19:38:56: Uninstalling plugin: GL RenderSystem
19:38:57: Unregistering ResourceManager for type GpuProgram
19:38:57: *** Stopping Win32GL Subsystem ***
19:38:57: Unregistering ResourceManager for type Texture
19:38:57: Plugin successfully uninstalled
19:38:57: Unloading library .\RenderSystem_GL
19:38:57: Uninstalling plugin: D3D9 RenderSystem
19:38:57: D3D9 : Shutting down cleanly.
19:38:57: D3D9 : Direct3D9 Rendering Subsystem destroyed.
19:38:57: Plugin successfully uninstalled
19:38:57: Unloading library .\RenderSystem_Direct3D9
19:38:57: Unregistering ResourceManager for type Material
Code: Select all
1>------ Build started: Project: BCClient, Configuration: Release Win32 ------
1> BCClient.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): warning C4244: 'initializing' : conversion from 'int' to 'Ogre::Real', possible loss of data
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,int>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=Ogre::Vector3,
1> _Ty2=Ogre::Real,
1> _Ty=Ogre::Vector3,
1> _Other1=Ogre::Vector3,
1> _Other2=int
1> ]
1> d:\ogre\bcclient\bcclient\include\sea_sky_handling.h(81) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<Ogre::Vector3,int>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=Ogre::Vector3,
1> _Ty2=Ogre::Real,
1> _Other1=Ogre::Vector3,
1> _Other2=int
1> ]
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): warning C4244: 'initializing' : conversion from 'double' to 'Ogre::Real', possible loss of data
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,double>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=Ogre::Vector3,
1> _Ty2=Ogre::Real,
1> _Ty=Ogre::Vector3,
1> _Other1=Ogre::Vector3,
1> _Other2=double
1> ]
1> d:\ogre\bcclient\bcclient\include\sea_sky_handling.h(82) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<Ogre::Vector3,double>(_Other1 &&,_Other2 &&)' being compiled
1> with
1> [
1> _Ty1=Ogre::Vector3,
1> _Ty2=Ogre::Real,
1> _Other1=Ogre::Vector3,
1> _Other2=double
1> ]
1> Generating code
1>d:\ogre\bcclient\bcclient\src\sea_sky_handling.cpp(45): warning C4700: uninitialized local variable 'mSceneMgr' used
1>d:\ogre\bcclient\bcclient\src\sea_sky_handling.cpp(52): warning C4700: uninitialized local variable 'mCamera' used
1> Finished generating code
1> BCClient.vcxproj -> D:\ogre\BCClient\BCClient\bin\Release\BCClient.exe
1> 1 file copiati.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Code: Select all
#ifndef __sea_sky_handling_h_
#define __sea_sky_handling_h_
#include <Ogre.h>
#include <OgreTextAreaOverlayElement.h>
#include "Hydrax/Hydrax.h"
#include "Hydrax/Noise/Perlin/Perlin.h"
#include "Hydrax/Modules/ProjectedGrid/ProjectedGrid.h"
#include "SkyX/SkyX.h"
struct ShadowConfig
{
bool Enable;
int Size;
ShadowConfig(const bool& Enable_, const int& Size_)
: Enable(Enable_)
, Size(Size_)
{
}
};
class BloomListener: public Ogre::CompositorInstance::Listener
{
public:
Hydrax::Hydrax *mHydrax;
SkyX::SkyX *mSkyX;
void notifyMaterialSetup(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
{
}
void notifyMaterialRender(Ogre::uint32 pass_id, Ogre::MaterialPtr &mat)
{
if (pass_id == 3)
{
float bloomStrength = 0.75 + Ogre::Math::Clamp<Ogre::Real>(-mSkyX->getAtmosphereManager()->getSunDirection().y, 0, 1)*0.75;
mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("uBloomStrength", bloomStrength);
}
}
};
void sea_sky_init(Ogre::Root *mRoot,Ogre::SceneManager* mSceneMgr,Ogre::RenderWindow* mWindow,Ogre::Camera* mCamera);
//void setShadowMode(Ogre::SceneManager *sm, const ShadowMode& smode);
class HydraxListener : public Ogre::FrameListener
{
public:
Ogre::SceneManager *mSceneMgr;
Ogre::Real mKeyBuffer;
Ogre::Real mLastPositionLength;
Ogre::Camera* mCamera;
// Color gradients
void updateEnvironmentLighting(void);
Hydrax::Hydrax *mHydrax;
SkyX::SkyX *mSkyX;
// Shadow config list
//ShadowConfig mShadowConfigList[] = {ShadowConfig(false, 0), ShadowConfig(true, 512), ShadowConfig(true, 2048)};
// Current shadow mode
// To disable shadows in night
// Time multiplier
SkyX::ColorGradient mWaterGradient,
mSunGradient,
mAmbientGradient;
HydraxListener(Ogre::RenderWindow* win, Ogre::Camera* cam, Ogre::SceneManager *sm)
: FrameListener()
, mSceneMgr(sm)
, mKeyBuffer(-1)
, mLastPositionLength((Ogre::Vector3(1500, 100, 1500) - mCamera->getDerivedPosition()).length())
{
// Color gradients
// Water
mWaterGradient = SkyX::ColorGradient();
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.779105)*0.4, 1));
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.729105)*0.3, 0.8));
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.679105)*0.25, 0.6));
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.679105)*0.2, 0.5));
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.679105)*0.1, 0.45));
mWaterGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.058209,0.535822,0.679105)*0.025, 0));
// Sun
mSunGradient = SkyX::ColorGradient();
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.8,0.75,0.55)*1.5, 1.0f));
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.8,0.75,0.55)*1.4, 0.75f));
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.8,0.75,0.55)*1.3, 0.5625f));
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.6,0.5,0.2)*1.5, 0.5f));
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.5,0.5,0.5)*0.25, 0.45f));
mSunGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(0.5,0.5,0.5)*0.01, 0.0f));
// Ambient
mAmbientGradient = SkyX::ColorGradient();
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*1, 1.0f));
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*1, 0.6f));
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*0.6, 0.5f));
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*0.3, 0.45f));
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*0.1, 0.35f));
mAmbientGradient.addCFrame(SkyX::ColorGradient::ColorFrame(Ogre::Vector3(1,1,1)*0.05, 0.0f));
}
bool frameStarted(const Ogre::FrameEvent &e)
{
// Check camera height
Ogre::RaySceneQuery *raySceneQuery =
mSceneMgr->
createRayQuery(Ogre::Ray(mCamera->getPosition() + Ogre::Vector3(0,1000000,0),
Ogre::Vector3::NEGATIVE_UNIT_Y));
Ogre::RaySceneQueryResult& qryResult = raySceneQuery->execute();
Ogre::RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
{
if (mCamera->getPosition().y < i->worldFragment->singleIntersection.y + 30)
{
mCamera->
setPosition(mCamera->getPosition().x,
i->worldFragment->singleIntersection.y + 30,
mCamera->getPosition().z);
}
}
delete raySceneQuery;
// Change SkyX atmosphere options if needed
SkyX::AtmosphereManager::Options SkyXOptions = mSkyX->getAtmosphereManager()->getOptions();
// Time
Ogre::Real mTimeMultiplier = 0.1f;
mSkyX->setTimeMultiplier(mTimeMultiplier);
//aumenta o diminuisci il tempo
/*
if (mKeyboard->isKeyDown(OIS::KC_1) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
mSkyX->setTimeMultiplier(1.0f);
if (mKeyboard->isKeyDown(OIS::KC_1) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
mSkyX->setTimeMultiplier(-1.0f);
*/
// Rayleigh multiplier
/*
if (mKeyboard->isKeyDown(OIS::KC_2) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.RayleighMultiplier += e.timeSinceLastFrame*0.025f;
if (mKeyboard->isKeyDown(OIS::KC_2) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.RayleighMultiplier -= e.timeSinceLastFrame*0.025f;
*/
/*
// Mie multiplier
if (mKeyboard->isKeyDown(OIS::KC_3) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.MieMultiplier += e.timeSinceLastFrame*0.025f;
if (mKeyboard->isKeyDown(OIS::KC_3) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.MieMultiplier -= e.timeSinceLastFrame*0.025f;
*/
/*
// Exposure
if (mKeyboard->isKeyDown(OIS::KC_4) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.Exposure += e.timeSinceLastFrame*0.5f;
if (mKeyboard->isKeyDown(OIS::KC_4) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.Exposure -= e.timeSinceLastFrame*0.5f;
*/
/*
// Inner radius
if (mKeyboard->isKeyDown(OIS::KC_5) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.InnerRadius += e.timeSinceLastFrame*0.25f;
if (mKeyboard->isKeyDown(OIS::KC_5) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.InnerRadius -= e.timeSinceLastFrame*0.25f;
*/
/*
// Outer radius
if (mKeyboard->isKeyDown(OIS::KC_6) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.OuterRadius += e.timeSinceLastFrame*0.25f;
if (mKeyboard->isKeyDown(OIS::KC_6) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.OuterRadius -= e.timeSinceLastFrame*0.25f;
*/
/*
// Number of samples
if (mKeyboard->isKeyDown(OIS::KC_7) && mKeyBuffer < 0 &&!(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
{
SkyXOptions.NumberOfSamples ++;
mKeyBuffer = 0.25f;
}
if (mKeyboard->isKeyDown(OIS::KC_7) && mKeyBuffer < 0 && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
{
SkyXOptions.NumberOfSamples --;
mKeyBuffer = 0.25f;
}
*/
/*
// Height position
if (mKeyboard->isKeyDown(OIS::KC_8) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.HeightPosition += e.timeSinceLastFrame*0.05f;
if (mKeyboard->isKeyDown(OIS::KC_8) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
SkyXOptions.HeightPosition -= e.timeSinceLastFrame*0.05f;
*/
/*
// Time multiplier
if (mKeyboard->isKeyDown(OIS::KC_9) && !(mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
mTimeMultiplier += e.timeSinceLastFrame*0.15f;
if (mKeyboard->isKeyDown(OIS::KC_9) && (mKeyboard->isKeyDown(OIS::KC_LSHIFT) || mKeyboard->isKeyDown(OIS::KC_RSHIFT)))
mTimeMultiplier -= e.timeSinceLastFrame*0.15f;
*/
mSkyX->getAtmosphereManager()->setOptions(SkyXOptions);
/*
// Post-proccesing effects
if (mKeyboard->isKeyDown(OIS::KC_F2) && mKeyBuffer < 0)
{
mBloomCompositor = !mBloomCompositor;
Ogre::CompositorManager::getSingleton().
setCompositorEnabled(mWindow->getViewport(0), "Bloom", mBloomCompositor);
mKeyBuffer = 0.25f;
}
// Shadows
if (mKeyboard->isKeyDown(OIS::KC_F3) && mKeyBuffer < 0)
{
mShadowMode++;
if (mShadowMode > 2)
{
mShadowMode = 0;
}
setShadowMode(mSceneMgr, static_cast<ShadowMode>(mShadowMode));
mKeyBuffer = 0.25f;
}
*/
// Update environment lighting
updateEnvironmentLighting();
// Update shadow far distance
updateShadowFarDistance();
// Update Hydrax
mHydrax->update(e.timeSinceLastFrame);
// Update SkyX
mSkyX->update(e.timeSinceLastFrame);
mKeyBuffer -= e.timeSinceLastFrame;
return true;
}
/** Update environment lighting
*/
/** Update shadow far distance
*/
void updateShadowFarDistance()
{
Ogre::Light* Light1 = mSceneMgr->getLight("Light1");
float currentLength = (Ogre::Vector3(1500, 100, 1500) - mCamera->getDerivedPosition()).length();
if (currentLength < 1000)
{
mLastPositionLength = currentLength;
return;
}
if (currentLength - mLastPositionLength > 100)
{
mLastPositionLength += 100;
Light1->setShadowFarDistance(Light1->getShadowFarDistance() + 100);
}
else if (currentLength - mLastPositionLength < -100)
{
mLastPositionLength -= 100;
Light1->setShadowFarDistance(Light1->getShadowFarDistance() - 100);
}
}
};
class HydraxRttListener : public Hydrax::RttManager::RttListener
{
public:
Hydrax::Hydrax *mHydrax;
SkyX::SkyX *mSkyX;
void preRenderTargetUpdate(const Hydrax::RttManager::RttType& Rtt)
{
// If needed in any case...
bool underwater = mHydrax->_isCurrentFrameUnderwater();
switch (Rtt)
{
case Hydrax::RttManager::RTT_REFLECTION:
{
// No stars in the reflection map
mSkyX->setStarfieldEnabled(false);
}
break;
case Hydrax::RttManager::RTT_REFRACTION:
{
}
break;
case Hydrax::RttManager::RTT_DEPTH: case Hydrax::RttManager::RTT_DEPTH_REFLECTION:
{
// Hide SkyX components in depth maps
mSkyX->getMeshManager()->getEntity()->setVisible(false);
mSkyX->getMoonManager()->getMoonBillboard()->setVisible(false);
}
break;
}
}
void postRenderTargetUpdate(const Hydrax::RttManager::RttType& Rtt)
{
bool underwater = mHydrax->_isCurrentFrameUnderwater();
switch (Rtt)
{
case Hydrax::RttManager::RTT_REFLECTION:
{
mSkyX->setStarfieldEnabled(true);
}
break;
case Hydrax::RttManager::RTT_REFRACTION:
{
}
break;
case Hydrax::RttManager::RTT_DEPTH: case Hydrax::RttManager::RTT_DEPTH_REFLECTION:
{
mSkyX->getMeshManager()->getEntity()->setVisible(true);
mSkyX->getMoonManager()->getMoonBillboard()->setVisible(true);
}
break;
}
}
};
#endif // #ifndef __sea_sky_handling_h_Code: Select all
#include "sea_sky_handling.h"
ShadowConfig mShadowConfigList[] = {ShadowConfig(false, 0), ShadowConfig(true, 512), ShadowConfig(true, 2048)};
bool mForceDisableShadows = false;
enum ShadowMode
{
SM_NONE = 0,
SM_LOW = 1,
SM_HIGH = 2
};
int mShadowMode = static_cast<int>(SM_LOW);
void setShadowMode(Ogre::SceneManager *sm, const ShadowMode& smode)
{
Ogre::MaterialPtr IslandMat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName("Island"));
if (mShadowConfigList[smode].Enable && !mForceDisableShadows)
{
sm->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED);
sm->setShadowTextureConfig(0, mShadowConfigList[smode].Size, mShadowConfigList[smode].Size, Ogre::PF_X8R8G8B8);
IslandMat->getTechnique(0)->setSchemeName("Default");
IslandMat->getTechnique(1)->setSchemeName("NoDefault");
}
else
{
sm->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
IslandMat->getTechnique(0)->setSchemeName("NoDefault");
IslandMat->getTechnique(1)->setSchemeName("Default");
}
}
void HydraxListener::updateEnvironmentLighting()
{
Ogre::SceneManager* mSceneMgr;
Ogre::Vector3 lightDir = mSkyX->getAtmosphereManager()->getSunDirection();
Ogre::Camera* mCamera;
bool preForceDisableShadows = mForceDisableShadows;
mForceDisableShadows = (lightDir.y > 0.15f) ? true : false;
if (preForceDisableShadows != mForceDisableShadows)
{
setShadowMode(mSceneMgr, static_cast<ShadowMode>(mShadowMode));
}
// Calculate current color gradients point
float point = (-lightDir.y + 1.0f) / 2.0f;
mHydrax->setWaterColor(mWaterGradient.getColor(point));
Ogre::Vector3 sunPos = mCamera->getDerivedPosition() - lightDir*mSkyX->getMeshManager()->getSkydomeRadius()*0.1;
mHydrax->setSunPosition(sunPos);
Ogre::Light *Light0 = mSceneMgr->getLight("Light0"),
*Light1 = mSceneMgr->getLight("Light1");
Light0->setPosition(mCamera->getDerivedPosition() - lightDir*mSkyX->getMeshManager()->getSkydomeRadius()*0.02);
Light1->setDirection(lightDir);
Ogre::Vector3 sunCol = mSunGradient.getColor(point);
Light0->setSpecularColour(sunCol.x, sunCol.y, sunCol.z);
Ogre::Vector3 ambientCol = mAmbientGradient.getColor(point);
Light0->setDiffuseColour(ambientCol.x, ambientCol.y, ambientCol.z);
mHydrax->setSunColor(sunCol);
}
void sea_sky_init(Ogre::Root *mRoot,Ogre::SceneManager* mSceneMgr,Ogre::RenderWindow* mWindow,Ogre::Camera* mCamera)
{
// Hydrax object
Hydrax::Hydrax *mHydrax = 0;
// SkyX object
SkyX::SkyX *mSkyX = 0;
bool mBloomCompositor = true;
// Hydrax initialization code ---------------------------------------------
// ------------------------------------------------------------------------
// Create Hydrax object
mHydrax = new Hydrax::Hydrax(mSceneMgr, mCamera, mWindow->getViewport(0));
// Create our projected grid module
Hydrax::Module::ProjectedGrid *mModule
= new Hydrax::Module::ProjectedGrid(// Hydrax parent pointer
mHydrax,
// Noise module
new Hydrax::Noise::Perlin(/*Generic one*/),
// Base plane
Ogre::Plane(Ogre::Vector3(0,1,0), Ogre::Vector3(0,0,0)),
// Normal mode
Hydrax::MaterialManager::NM_VERTEX,
// Projected grid options
Hydrax::Module::ProjectedGrid::Options(/*Generic one*/));
// Set our module
mHydrax->setModule(static_cast<Hydrax::Module::Module*>(mModule));
// Load all parameters from config file
// Remarks: The config file must be in Hydrax resource group.
// All parameters can be set/updated directly by code(Like previous versions),
// but due to the high number of customizable parameters, since 0.4 version, Hydrax allows save/load config files.
mHydrax->loadCfg("HydraxDemo.hdx");
// Create water
mHydrax->create();
// Add the Hydrax Rtt listener
mHydrax->getRttManager()->addRttListener(new HydraxRttListener());
// Hydrax initialization code end -----------------------------------------
// ------------------------------------------------------------------------
// SkyX initialization code ---------------------------------------------
// ------------------------------------------------------------------------
// Create SkyX object
mSkyX = new SkyX::SkyX(mSceneMgr, mCamera);
// No smooth fading
mSkyX->getMeshManager()->setSkydomeFadingParameters(false);
// A little change to default atmosphere settings :)
SkyX::AtmosphereManager::Options atOpt = mSkyX->getAtmosphereManager()->getOptions();
atOpt.RayleighMultiplier = 0.003075f;
atOpt.MieMultiplier = 0.00125f;
atOpt.InnerRadius = 9.92f;
atOpt.OuterRadius = 10.3311f;
mSkyX->getAtmosphereManager()->setOptions(atOpt);
// Create the sky
mSkyX->create();
// Add a basic cloud layer
mSkyX->getCloudsManager()->add(SkyX::CloudLayer::Options(/* Default options */));
// SkyX initialization code end -----------------------------------------
// ------------------------------------------------------------------------
// Bloom compositor
Ogre::CompositorManager::getSingleton().
addCompositor(mWindow->getViewport(0), "Bloom")->addListener(new BloomListener());
Ogre::CompositorManager::getSingleton().
setCompositorEnabled(mWindow->getViewport(0), "Bloom", mBloomCompositor);
// Shadows
mSceneMgr->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(new Ogre::FocusedShadowCameraSetup()));
mSceneMgr->setShadowTextureCasterMaterial("ShadowCaster");
mSceneMgr->getLight("Light1")->setShadowFarDistance(1750);
setShadowMode(mSceneMgr, static_cast<ShadowMode>(mShadowMode));
// Add the Hydrax depth technique to island material
mHydrax->getMaterialManager()->addDepthTechnique(
static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().getByName("Island"))
->createTechnique());
// Add frame listener
mRoot->addFrameListener(new HydraxListener(mWindow, mCamera, mSceneMgr));
}