ScreenOutdoors.cpp

Go to the documentation of this file.
00001 #include "ScreenOutdoors.h"
00002 #include "MercuryTheme.h"
00003 #include "MercuryDisplay.h"
00004 
00005 //Do not register this screen as its own class.  There is no situation
00006 //that we would want to create nothing than an outdoors environment.
00007 
00008 ScreenOutdoors::~ScreenOutdoors()
00009 {
00010     DISPLAY->EnableGLState(MGLS_CLEARFRAME);
00011     DISPLAY->PopGLState();
00012 }
00013 
00014 void ScreenOutdoors::Init()
00015 {
00016     MercuryScreen::Init();
00017 
00018     m_light.Init();
00019     m_light.Tweening.AddCommand( THEME.GetMetricS( GetName(), "SunTween" ) );
00020     m_light.SetAttenuation(0.001f, Attenuation::LINEAR);
00021     m_light.SetStatic(true);
00022     DISPLAY->AddLight(&m_light);
00023 
00024     m_pSkyBox = new MercurySkyBox;
00025     m_pSkyBox->SetName( "SkyBox" );
00026     m_pSkyBox->Init();
00027     m_pSkyBox->Load( THEME.GetMetricS( GetName(), "SkyBox" ) );
00028     m_pSkyBox->SetRotX( 90 );
00029     m_pSkyBox->GetGLState().Disable(MGLS_LIGHTING | MGLS_DEPTHWRITE);
00030     m_pSkyBox->BindToCamera( &m_pCamera );
00031 
00032     //m_background will delete skybox for us
00033     m_pBackground = m_pSkyBox;
00034 
00035     DISPLAY->PushGLState();
00036     DISPLAY->DisableGLState(MGLS_CLEARFRAME);
00037 }
00038 
00039 void MercurySkyBox::Update(const float dTime)
00040 {
00041     if ( m_boundCamera && *m_boundCamera )
00042         SetPosition( (*m_boundCamera)->GetPosition() );
00043     MercuryLoadableModel::Update(dTime);
00044 }
00045 
00046 /* 
00047  * Copyright (c) 2006, Charles Lohr
00048  * All rights reserved.
00049  *
00050  * Redistribution and use in source and binary forms, with or
00051  * without modification, are permitted provided that the following
00052  * conditions are met:
00053  *  -   Redistributions of source code must retain the above
00054  *      copyright notice, this list of conditions and the following disclaimer.
00055  *  -   Redistributions in binary form must reproduce the above copyright
00056  *      notice, this list of conditions and the following disclaimer in
00057  *      the documentation and/or other materials provided with the distribution.
00058  *  -   Neither the name of the Mercury Engine nor the names of its
00059  *      contributors may be used to endorse or promote products derived from
00060  *      this software without specific prior written permission.
00061  *
00062  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00063  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00064  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00065  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00066  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00067  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00068  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00069  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00070  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00071  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00072  */

Hosted by SourceForge.net Logo