|
@@ -100,125 +100,6 @@ ConsoleMethod(Scene, getPositionIterations, S32, 2, 2, "() Gets the number of p
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
-ConsoleMethod(Scene, setBackgroundColor, void, 3, 6, "(float red, float green, float blue, [float alpha = 1.0]) or ( stockColorName ) - Sets the background color for the scene."
|
|
|
|
- "@param red The red value.\n"
|
|
|
|
- "@param green The green value.\n"
|
|
|
|
- "@param blue The blue value.\n"
|
|
|
|
- "@param alpha The alpha value.\n"
|
|
|
|
- "@return No return Value.")
|
|
|
|
-{
|
|
|
|
- // The colors.
|
|
|
|
- F32 red;
|
|
|
|
- F32 green;
|
|
|
|
- F32 blue;
|
|
|
|
- F32 alpha = 1.0f;
|
|
|
|
-
|
|
|
|
- // Space separated.
|
|
|
|
- if (argc == 3)
|
|
|
|
- {
|
|
|
|
- // Grab the element count.
|
|
|
|
- const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
|
|
|
|
-
|
|
|
|
- // Has a single argument been specified?
|
|
|
|
- if ( elementCount == 1 )
|
|
|
|
- {
|
|
|
|
- object->setDataField( StringTable->insert("BackgroundColor"), NULL, argv[2] );
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // ("R G B [A]")
|
|
|
|
- if ((elementCount == 3) || (elementCount == 4))
|
|
|
|
- {
|
|
|
|
- // Extract the color.
|
|
|
|
- red = dAtof(Utility::mGetStringElement(argv[2], 0));
|
|
|
|
- green = dAtof(Utility::mGetStringElement(argv[2], 1));
|
|
|
|
- blue = dAtof(Utility::mGetStringElement(argv[2], 2));
|
|
|
|
-
|
|
|
|
- // Grab the alpha if it's there.
|
|
|
|
- if (elementCount > 3)
|
|
|
|
- alpha = dAtof(Utility::mGetStringElement(argv[2], 3));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Invalid.
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Con::warnf("Scene::setBackgroundColor() - Invalid Number of parameters!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // (R, G, B)
|
|
|
|
- else if (argc >= 5)
|
|
|
|
- {
|
|
|
|
- red = dAtof(argv[2]);
|
|
|
|
- green = dAtof(argv[3]);
|
|
|
|
- blue = dAtof(argv[4]);
|
|
|
|
-
|
|
|
|
- // Grab the alpha if it's there.
|
|
|
|
- if (argc > 5)
|
|
|
|
- alpha = dAtof(argv[5]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Invalid.
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- Con::warnf("Scene::setBackgroundColor() - Invalid Number of parameters!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Set background color.
|
|
|
|
- object->setBackgroundColor(ColorF(red, green, blue, alpha) );
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-ConsoleMethod(Scene, getBackgroundColor, const char*, 2, 2, "Gets the background color for the scene.\n"
|
|
|
|
- "@return (float red / float green / float blue / float alpha) The background color for the scene.")
|
|
|
|
-{
|
|
|
|
- // Get the background color.
|
|
|
|
- const ColorF& color = object->getBackgroundColor();
|
|
|
|
-
|
|
|
|
- // Fetch color name.
|
|
|
|
- StringTableEntry colorName = StockColor::name( color );
|
|
|
|
-
|
|
|
|
- // Return the color name if it's valid.
|
|
|
|
- if ( colorName != StringTable->EmptyString )
|
|
|
|
- return colorName;
|
|
|
|
-
|
|
|
|
- // Create Returnable Buffer.
|
|
|
|
- char* pBuffer = Con::getReturnBuffer(64);
|
|
|
|
-
|
|
|
|
- // Format Buffer.
|
|
|
|
- dSprintf(pBuffer, 64, "%g %g %g %g", color.red, color.green, color.blue, color.alpha );
|
|
|
|
-
|
|
|
|
- // Return buffer.
|
|
|
|
- return pBuffer;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-ConsoleMethod(Scene, setUseBackgroundColor, void, 3, 3, "Sets whether to use the scene background color or not.\n"
|
|
|
|
- "@param useBackgroundColor Whether to use the scene background color or not.\n"
|
|
|
|
- "@return No return value." )
|
|
|
|
-{
|
|
|
|
- // Fetch flag.
|
|
|
|
- const bool useBackgroundColor = dAtob(argv[2]);
|
|
|
|
-
|
|
|
|
- // Set the flag.
|
|
|
|
- object->setUseBackgroundColor( useBackgroundColor );
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
-ConsoleMethod(Scene, getUseBackgroundColor, bool, 2, 2, "Gets whether the scene background color is in use or not.\n"
|
|
|
|
- "@return Whether the scene background color is in use or not." )
|
|
|
|
-{
|
|
|
|
- // Get the flag.
|
|
|
|
- return object->getUseBackgroundColor();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
|
-
|
|
|
|
ConsoleMethod(Scene, add, void, 3, 3, "(sceneObject) Add the SceneObject to the scene.\n"
|
|
ConsoleMethod(Scene, add, void, 3, 3, "(sceneObject) Add the SceneObject to the scene.\n"
|
|
"@param sceneObject The SceneObject to add to the scene.\n"
|
|
"@param sceneObject The SceneObject to add to the scene.\n"
|
|
"@return No return value.")
|
|
"@return No return value.")
|