コード例 #1
0
void GraphicsSystem::SetProperties( Properties::Array Properties )
{
	ASSERT( m_bInitialized );

	//
	// Read in the properties.
	//
	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
	{
		if ( it->GetFlags() & Properties::Flags::Valid )
		{
			std::string sName = it->GetName();

			if ( sName == sm_kapszPropertyNames[ Property_Resolution ] )
			{
				u32 Width  = static_cast<u32>(it->GetInt32( 0 ));
				u32 Height = static_cast<u32>(it->GetInt32( 1 ));

				//m_pRenderWindow->resize( Width, Height );
			}
			else
			{
				ASSERT( False );
			}

			//
			// Set this property to invalid since it's already been read.
			//
			it->ClearFlag( Properties::Flags::Valid );
		}
	}
}
コード例 #2
0
void
InputObject::GetProperties(
    Properties::Array& Properties
    )
{
	//
    // Get the index of our first item.
    //
    i32 iProperty = static_cast<i32>(Properties.size());

    //
    // Add all the properties.
    //
    Properties.reserve( Properties.size() + Property_Count );

    for ( i32 i=0; i < Property_Count; i++ )
    {
        Properties.push_back( sm_kaDefaultProperties[ i ] );
    }

    //
    // Modify the default values.
    //
	Properties[iProperty + Property_FKey].SetValue(0, m_nFunctionKey);
}
コード例 #3
0
void
GeometryObject::GetProperties(
    Properties::Array& Properties
    )
{
    //
    // Get the index of our first item.
    //
    i32 iProperty = static_cast<i32>(Properties.size());

    //
    // Add all the properties.
    //
    Properties.reserve( Properties.size() + Property_Count );

    for ( i32 i=0; i < Property_Count; i++ )
    {
        Properties.push_back( sm_kaDefaultProperties[ i ] );
    }

    //
    // Modify the default values.
    //
    Properties[ iProperty+Property_Position ].SetValue( m_Position );
    Properties[ iProperty+Property_Orientation ].SetValue( m_Orientation );
    Properties[ iProperty+Property_Scale ].SetValue( m_Scale );
}
コード例 #4
0
void
InputObject::SetProperties(
    Properties::Array Properties
    )
{
    ASSERT( m_bInitialized );

	Error Err;
	Err = Errors::Failure;

    //
    // Read in the properties.
    //
    for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
    {
        if ( it->GetFlags() & Properties::Flags::Valid )
        {
            std::string sName = it->GetName();
 
            if ( sName == sm_kapszPropertyNames[Property_FKey] )
            {
				m_nFunctionKey = it->GetInt32(0);
			}
			else if ( sName == sm_kapszPropertyNames[Property_Orientation] )
			{
				m_Yaw   = it->GetFloat32(0);
				m_Pitch = it->GetFloat32(1);
				m_Roll  = it->GetFloat32(2);

				m_Orientation.x = m_Yaw;
				m_Orientation.y = m_Pitch;
				m_Orientation.z = 0;
				m_Orientation.w = 0;

				PostChanges(System::Changes::Geometry::Orientation);
			}
            else
            {
                ASSERT(False);
            }
            //
            // Set this property to invalid since it's already been read.
            //
            it->ClearFlag(Properties::Flags::Valid);
        }
    }
}
コード例 #5
0
ファイル: ObjectCamera.cpp プロジェクト: h-s-c/smoke_port
void
OGREGraphicsObjectCamera::GetProperties(
    Properties::Array& Properties
    )
{
    //
    // Get the index of our first item.
    //
    i32 iProperty = static_cast<i32>(Properties.size());

    //
    // Add all the properties.
    //
    Properties.reserve( Properties.size() + Property_Count );

    for (auto & property : sm_kaDefaultProperties)
    {
        Properties.push_back( property );
    }

    //
    // Set the enum options string array.
    //
    Properties[ iProperty+Property_PolygonMode ].SetEnumOptions( sm_kapszPolygonModeEnumOptions );

    //
    // Modify the default values.
    //
    if ( m_pCamera != nullptr )
    {
        Properties[ iProperty+Property_FOVy ].SetValue( 0, m_pCamera->getFOVy().valueRadians() );

        Properties[ iProperty+Property_ClipDistances ].SetValue(
            0, m_pCamera->getNearClipDistance()
            );
        Properties[ iProperty+Property_ClipDistances ].SetValue(
            1, m_pCamera->getFarClipDistance()
            );

        Ogre::Vector3 Position = m_pCamera->getPosition();
        Properties[ iProperty+Property_Position ].SetValue( 0, Position.x );
        Properties[ iProperty+Property_Position ].SetValue( 1, Position.y );
        Properties[ iProperty+Property_Position ].SetValue( 2, Position.z );

        Properties[ iProperty+Property_PolygonMode ].SetValue( 0, m_PolygonMode );
    }
}
コード例 #6
0
void GraphicsSystem::GetProperties( Properties::Array& Properties )
{
	//
	// Get the index of our first item.
	//
	i32 iProperty = static_cast<i32>(Properties.size());

	//
	// Add all the properties.
	//
	Properties.reserve( Properties.size() + Property_Count );

	for ( i32 i=0; i < Property_Count; i++ )
	{
		Properties.push_back( sm_kaDefaultProperties[ i ] );
	}
	
}
コード例 #7
0
void
GeometryObject::SetProperties(
    Properties::Array Properties
    )
{
    ASSERT( m_bInitialized );

    //
    // Read in the properties.
    //
	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
    {
        std::string sName = it->GetName();

        if ( it->GetFlags() & Properties::Flags::Valid )
        {
            if ( sName == sm_kapszPropertyNames[ Property_Position ] )
            {
                m_Position = it->GetVector3();
                PostChanges( System::Changes::Geometry::Position );
            }
            else if ( sName == sm_kapszPropertyNames[ Property_Orientation ] )
            {
                m_Orientation = it->GetQuaternion();
                PostChanges( System::Changes::Geometry::Orientation );
            }
            else if ( sName == sm_kapszPropertyNames[ Property_Scale ] )
            {
                m_Scale = it->GetVector3();
                PostChanges( System::Changes::Geometry::Scale );
            }
            else
            {
                ASSERT( False );
            }

            //
            // Set this property to invalid since it's already been read.
            //
            it->ClearFlag( Properties::Flags::Valid );
        }
    }
}
コード例 #8
0
Error GraphicsSystem::Initialize( Properties::Array Properties )
{
	ASSERT( !m_bInitialized );

	// Read in the properties required to initialize Ogre.
	//
	char    szWindowName[ 256 ] = "Window";
	u32		Width = 1280;
	u32		Height = 1024;
	Bool    bFullScreen = False;
	Bool    bVerticalSync = True;
	std::string     dFSAAType    = "0";  //D3DMULTISAMPLE_NONE;
	std::string     dFSAAQuality = "0";

	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
	{
		//
		// Make sure this property is valid.
		//
		if ( it->GetFlags() & Properties::Flags::Valid )
		{
			std::string sName = it->GetName();

			if ( sName == sm_kapszPropertyNames[ Property_ResourceLocation ] )
			{
				pcstr pszName = it->GetStringPtr( 0 );
				pcstr pszLocationType = it->GetStringPtr( 1 );
				pcstr pszResourceGroup = it->GetStringPtr( 2 );
				Bool  bRecursive = it->GetBool( 3 ); 

				/*m_pResourceGroupManager->addResourceLocation(
					pszName, pszLocationType, pszResourceGroup, (bRecursive == True) );

				m_pResourceGroupManager->loadResourceGroup( pszResourceGroup );*/
			}
			else if ( sName == sm_kapszPropertyNames[ Property_WindowName ] )
			{
				strcpy_s( szWindowName, sizeof szWindowName, it->GetStringPtr( 0 ) );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_Resolution ] )
			{
				Width  = static_cast<u32>(it->GetInt32( 0 ));
				Height  = static_cast<u32>(it->GetInt32( 1 ));
			}
			else if ( sName == sm_kapszPropertyNames[ Property_ShadowTextureCount ] )
			{
				m_uShadowTextureCount  = static_cast<u16>(it->GetInt32( 0 ));
			}
			else if ( sName == sm_kapszPropertyNames[ Property_ShadowTextureSize ] )
			{
				m_uShadowTextureSize  = static_cast<u16>(it->GetInt32( 0 ));
			}
			else if ( sName == sm_kapszPropertyNames[ Property_FullScreen ] )
			{
				bFullScreen = it->GetBool( 0 );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_VerticalSync ] )
			{
				bVerticalSync = it->GetBool( 0 );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_FSAntiAliasing ] )
			{                
				dFSAAType    = it->GetString( 0 );
				dFSAAQuality = it->GetString( 1 );
			}
			//
			// Set this property to invalid since it's already been read.
			//
			it->ClearFlag( Properties::Flags::Valid );
		}
	}

	//
	// Command line overrides
	//
	{
		USES_CONVERSION;

		WCHAR**				argv;
		int					argc, iArg;

		argv = CommandLineToArgvW( GetCommandLineW(), &argc);
		for(iArg=0; iArg<argc; iArg++)
		{
			switch (*argv[iArg])
			{
			case '-':
			case '/':
				{
					if (0==_wcsicmp(argv[iArg]+1, L"windowed" ))	bFullScreen = False;
				}	break;

			default:
				{
				}
			}
		}

		LocalFree(argv);
	}

	//
	// Intialize the render system and render window.
	//
	// Setup the Full-screen Anti-Aliasing mode
	std::map<std::string, std::string> params;
	params[ "FSAA" ]        = dFSAAType;
	params[ "FSAAQuality" ] = dFSAAQuality;


	m_bInitialized = True;

	//
	// Set the remaining properties.
	//
	SetProperties( Properties );

	return Errors::Success;
}
コード例 #9
0
void GraphicsScene::SetProperties( Properties::Array Properties )
{
	ASSERT( m_bInitialized );

	//
	// Read in the properties.
	//
	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
	{
		if ( it->GetFlags() & Properties::Flags::Valid )
		{
			std::string sName = it->GetName();


			if ( sName == sm_kapszPropertyNames[ Property_AmbientLight ] )
			{
				//
				// Set the scene's ambient light.
				//
				ColourValue AmbientLight;

				AmbientLight.a = 1.0f;
				AmbientLight.r = it->GetColor3().r;
				AmbientLight.g = it->GetColor3().g;
				AmbientLight.b = it->GetColor3().b;
			}
			else if ( sName == sm_kapszPropertyNames[ Property_Shadows ] )
			{
				//
				// Enable/disable shadows.
				//
			}
			else if ( sName == sm_kapszPropertyNames[ Property_ShadowColor ] )
			{
				//
				// Set the scene's shadow color.
				//
				ColourValue ShadowColor;

				ShadowColor = ColourValue( it->GetColor3().r,
					it->GetColor3().g,
					it->GetColor3().b );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_DrawBoundingBox ] )
			{
				//
				// Enable/disable the drawing of Object BoundingBoxes.
				//
			}
			else
			{
				ASSERT( False );
			}


			//
			// Set this property to invalid since it's already been read.
			//
			it->ClearFlag( Properties::Flags::Valid );
		}
	}
}
コード例 #10
0
Error GraphicsScene::Initialize( Properties::Array Properties )
{
	Error Err = Errors::Success;

	ASSERT( !m_bInitialized );

	m_pTask = new GraphicsTask( this );
	ASSERT( m_pTask != NULL );

	//
	// Set this set as initialized.
	//
	m_bInitialized = True;
	//
	// Read the properties.
	//
	for ( Properties::Iterator it=Properties.begin(); it != Properties.end(); it++ )
	{
		if ( it->GetFlags() & Properties::Flags::Valid &&
			it->GetFlags() & Properties::Flags::InitOnly)
		{
			std::string sName = it->GetName();
			if ( sName == sm_kapszPropertyNames[ Property_ResourceLocation ] )
			{
				pcstr pszName = it->GetStringPtr( 0 );
				pcstr pszLocationType = it->GetStringPtr( 1 );
				pcstr pszResourceGroup = it->GetStringPtr( 2 );
				Bool  bRecursive = it->GetBool( 3 ); 
			}
			else if ( sName == sm_kapszPropertyNames[ Property_DelResourceLocation ] )
			{
				pcstr pszName = it->GetStringPtr( 0 );
				pcstr pszResourceGroup = it->GetStringPtr( 1 );

			}
			else if ( sName == sm_kapszPropertyNames[ Property_UseStaticGeom ] )
			{
				m_bUseStaticGeom = it->GetBool( 0 );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_UseInstancedGeom ] )
			{
				m_bUseInstancedGeom = it->GetBool( 0 );
			}
			else if ( sName == sm_kapszPropertyNames[ Property_FogColor ] )
			{
				m_FogColor.r = it->GetColor3().r;
				m_FogColor.g = it->GetColor3().g;
				m_FogColor.b = it->GetColor3().b;
			}
			else if ( sName == sm_kapszPropertyNames[ Property_Fog ] )
			{
				i32 mode = it->GetInt32(0);
				switch ( mode )
				{
				case 1:
					m_FogMode = ::FOG_EXP;
					break;
				case 2:
					m_FogMode = ::FOG_EXP2;
					break;
				case 3:
					m_FogMode = ::FOG_LINEAR;
					break;
				default:
					m_FogMode = ::FOG_NONE;
					break;
				}
				m_ExpDensity  = it->GetFloat32(1);
				m_LinearStart = it->GetFloat32(2);
				m_LinearEnd   = it->GetFloat32(3);
			}
			else if ( sName == sm_kapszPropertyNames[ Property_Font ] )
			{
				//-------------------------------------------------------------------------
				// Here is where we load the "default" font into the  resource system. We don't need
				// to keep any references to the resource around as it will be accessed by name by anyone
				// who needs the resource.
				//
				std::string sPath = it->GetString(0);
				std::string sFile = it->GetString(1);
			}
			//
			// Load the paged geometry information. This is broken up between three areas. Here, the camera,
			// and the individual layers in ObjectPagedGeometryLayer.cpp. Here, we initialize the system and
			// load general information that will be shared between all layers. In ObjectCamera the camera
			// needs to be associated with PagedGeometry. There can be multiple layers (e.g. grass, rocks, flowers)
			// so they are taken care of as their own objects.
			//
			else if ( sName == sm_kapszPropertyNames[ Property_PagedGeometry ] )
			{
				// Terrain Setting
			}
			else
			{
				ASSERT( False );
			}
			//
			// Set this property to invalid since it's already been read.
			//
			it->ClearFlag( Properties::Flags::Valid );
		}
	}

	//
	// Intialize any resource groups added by the scene
	//
	//
	// Set the properties for this scene.
	//
	SetProperties( Properties );

	//
	// Set some of the shadow properties even though shadows might be disabled.
	//
	// Shadow Setting


	//-------------------------------------------------------------------------
	// This is where we "create" the overlay manager by retrieving its pointer. We
	// also create one overlay which is currently the only one in the system. All
	// overlay elements are currently attached to it.
	//

	//-------------------------------------------------------------------------
	// Here we set the fog properties for the scene
	//
	return Err;
}