Commit 623c2985 authored by Jan Möbius's avatar Jan Möbius

Mangle ui files from Objecttypes

parents
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
/**
* \file Light.hh
* This File contains all required includes for using Light Sources
*/
#ifndef LIGHT_INCLUDE_HH
#define LIGHT_INCLUDE_HH
//== INCLUDES =================================================================
/** \def DATA_LIGHT
* Use this macro to reference light objects
*/
#define DATA_LIGHT typeId("Light")
#include <ObjectTypes/Light/LightObject.hh>
#include <ObjectTypes/Light/PluginFunctionsLight.hh>
#include <ObjectTypes/Light/LightTypes.hh>
//=============================================================================
#endif // LIGHT_INCLUDE_HH defined
//=============================================================================
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Types
//
//=============================================================================
/**
* \file LightObject.hh
* This File contains the Light Object
*/
#ifndef LIGHTOBJECT_HH
#define LIGHTOBJECT_HH
//== INCLUDES =================================================================
#include <OpenFlipper/common/BaseObjectData.hh>
#include <OpenFlipper/common/GlobalDefines.hh>
#include "LightTypes.hh"
//== TYPEDEFS =================================================================
// //== CLASS DEFINITION =========================================================
class DLLEXPORT LightObject : public BaseObjectData {
friend class TypeLightPlugin;
friend class LightWidget;
public:
/// constructor
LightObject();
/** \brief copy constructor
*
* Create a copy of this object
*/
LightObject(const LightObject& _object);
/// destructor
virtual ~LightObject();
/// Reset current object, including all related nodes.
virtual void cleanup();
/** return a full copy of this object ( All scenegraph nodes will be created )
* but the object will not be a part of the object tree.
*/
BaseObject* copy();
protected:
/// Initialize current object, including all related nodes.
virtual void init(LightNode* _light = 0, LightNode* _lightVis = 0);
//===========================================================================
/** @name Name and Path handling
* @{ */
//===========================================================================
public:
/// Set the name of the Object
void setName( QString _name );
/** @} */
//===========================================================================
/** @name Contents
* @{ */
//===========================================================================
public:
LightSource* lightSource();
/// Is light default light source?
bool defaultLight() const { return defaultLightSource_; }
/// Set light object to be default light
void defaultLight( const bool _default ) { defaultLightSource_ = _default; }
private:
LightSource lightSource_;
/// True if light is default light source initially
/// added to a blank scene
bool defaultLightSource_;
/** @} */
//===========================================================================
/** @name Update handling
*
* This is mostly private. Updates have to be triggered via
* emit updatedObject()
*
* @{ */
//===========================================================================
protected:
/** \brief Update the Light Object
*
* Updates the rendering of the light object
*/
virtual void update(UpdateType _type = UPDATE_ALL);
/** @} */
//===========================================================================
/** @name Visualization
* @{ */
//===========================================================================
public:
/// Get the scenegraph Node
LightNode* lightNode();
/// Get the scenegraph Node
LightNode* lightNodeVis();
virtual bool hasNode(BaseNode* _node);
private:
/// Light status node
LightNode* lightNode_;
/// Light rendering node (only for rendering purposes)
LightNode* lightNodeVis_;
/** @} */
//===========================================================================
/** @name Object Information
* @{ */
//===========================================================================
public:
/// Get all Info for the Object as a string
QString getObjectinfo();
/** @} */
//===========================================================================
/** @name Picking
* @{ */
//===========================================================================
public:
/// detect if the node has been picked
bool picked( uint _node_idx );
/// Enable or disable picking for this Object
void enablePicking( bool _enable );
/// Check if picking is enabled for this Object
bool pickingEnabled();
/** @} */
public:
/// Show Light Node
virtual void visible(bool _visible);
/// Show Light Node
virtual bool visible();
/// Show Light Node
virtual void show();
/// Hide Light Node
virtual void hide();
};
//=============================================================================
#endif // LIGHTOBJECT_HH defined
//=============================================================================
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Light Types
//
//=============================================================================
/**
* \file LightTypes.hh
* This File contains the required types and typedefs for using Lights
*/
#ifndef LIGHT_TYPES_HH
#define LIGHT_TYPES_HH
//== INCLUDES =================================================================
#include <ObjectTypes/Light/LightNode.hh>
//== TYPEDEFS FOR SCENEGRAPH ===============================================
/// Simple Name for the LightSource
typedef ACG::SceneGraph::LightSource LightSource;
/// Simple Name for PlaneNode
typedef ACG::SceneGraph::LightNode LightNode;
//=============================================================================
#endif // LIGHT_TYPES_HH defined
//=============================================================================
This diff is collapsed.
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
#include <ObjectTypes/Light/LightNode.hh>
#include <ui_lightWidget.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <OpenFlipper/common/GlobalDefines.hh>
#include "Light.hh"
class DLLEXPORT LightWidget : public QDialog, public Ui::LightWidgetBase
{
Q_OBJECT
public:
LightWidget( ACG::SceneGraph::BaseNode* _node, QWidget *parent = 0);
private slots:
/// The directional checkbox changed -> update object
void directionalToggled();
/// The fixed position checkbox
void fixedPositionChanged();
/// Color values have changed
void ambientChanged();
void diffuseChanged();
void specularChanged();
/// Brightness value has changed
void brightnessChanged(int _newValue);
/// Light radius has changed
void radiusChanged();
/// Spot direction changed
void spotChanged();
protected:
/// Initialize contents of widget before showing it
virtual void showEvent ( QShowEvent * event );
private:
/// Initializes the internal object. Returns true if successfull
bool getObject();
/// Called when the object has been updated
void updated();
private:
ACG::SceneGraph::LightNode* node_;
LightObject* object_;
LightSource* light_;
bool updatingWidgets_;
};
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Plugin Functions for Lights
//
//=============================================================================
#include <OpenFlipper/common/Types.hh>
#include "PluginFunctionsLight.hh"
namespace PluginFunctions {
// ===============================================================================
// Get objects
// ===============================================================================
bool getObject( int _identifier , LightObject*& _object ) {
if ( _identifier == BaseObject::NOOBJECT ) {
_object = 0;
return false;
}
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< LightObject* >(object);
return ( _object != 0 );
}
// ===============================================================================
// Getting data from objects and casting between them
// ===============================================================================
LightNode* lightNode( BaseObjectData* _object ) {
if ( _object->dataType(DATA_LIGHT) ) {
LightObject* object = dynamic_cast< LightObject* >(_object);
return object->lightNode();
} else
return 0;
}
LightObject* lightObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_LIGHT) )
return 0;
return dynamic_cast< LightObject* >( _object );
}
LightSource* lightSource( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_LIGHT) )
return 0;
LightObject* light = dynamic_cast< LightObject* >( _object );
return light->lightSource();
}
DLLEXPORT
LightSource* lightSource( LightObject* _object ) {
if ( ! _object )
return 0;
return _object->lightSource();
}
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* *
\*===========================================================================*/
//=============================================================================
//
// Standard Functions
//
//=============================================================================
/**
* \file PluginFunctionsLight.hh
* This file contains functions which can be used by plugins to access lights in the framework.
*/
//
#ifndef PLUGINFUNCTI