Commit cbbd29a2 authored by Jan Möbius's avatar Jan Möbius

Separated Splatcloud type and fixed minor sphere type issues

parents
include(ACGCommon)
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
link_directories (
${GLEW_LIBRARY_DIR}
${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)
#=======================================================
# General defines
#=======================================================
# generate dllexport macros on windows
if (WIN32)
add_definitions (
-DPLUGINLIBDLL
-DUSEPLUGINLIBDLL
-DBUILDOBJECTTYPEDLL
-DACGDLL
-DUSEACG
)
endif ()
#=======================================================
# Cleanup
#=======================================================
# collect all header,source files
acg_append_files (headers "*.hh" . )
acg_append_files (sources "*.cc" . SplatCloud )
acg_qt5_automoc (moc_targets ${headers})
# Match our current directory name
string (REGEX MATCH "[^/\\]*$" TYPENAME ${CMAKE_CURRENT_SOURCE_DIR})
string(TOUPPER ${TYPENAME} TYPENAME )
include_directories (
..
${ACG_INCLUDE_DIR}
${OPENMESH_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_BINARY_DIR}
${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
)
# remove template cc files from source file list
acg_drop_templates (sources)
acg_add_library ( ${TYPENAME} SHARED ${sources} ${headers} ${moc_targets})
add_dependencies( ${TYPENAME} OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib)
target_link_libraries (${TYPENAME}
${OPENMESH_LIBRARIES}
ACG
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
${GLUT_LIBRARIES}
OpenFlipperPluginLib
)
/*===========================================================================*\
* *
* 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 SplatClouds
//
//================================================================
//== INCLUDES ====================================================
#include "PluginFunctionsSplatCloud.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
//== NAMESPACES ==================================================
namespace PluginFunctions {
//== IMPLEMENTATION ==============================================
//================================================================
// Get objects
//================================================================
bool getObject( int _identifier, SplatCloudObject *&_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<SplatCloudObject *>( object );
return (_object != 0);
}
//================================================================
// Getting data from objects and casting between them
//================================================================
ShaderNode* splatShaderNode( BaseObjectData *_object )
{
if( !_object )
return 0;
if( !_object->dataType( DATA_SPLATCLOUD ) )
return 0;
SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
if ( object == 0 )
return 0;
return object->shaderNode();
}
//----------------------------------------------------------------
SplatCloudNode* splatCloudNode( BaseObjectData *_object )
{
if( !_object )
return 0;
if( !_object->dataType( DATA_SPLATCLOUD ) )
return 0;
SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
if ( object == 0 )
return 0;
return object->splatCloudNode();
}
//----------------------------------------------------------------
SplatCloud* splatCloud( BaseObjectData *_object )
{
if( !_object )
return 0;
if( !_object->dataType( DATA_SPLATCLOUD ) )
return 0;
SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
if ( object == 0 )
return 0;
return object->splatCloud();
}
//----------------------------------------------------------------
SplatCloudObject* splatCloudObject( BaseObjectData *_object )
{
if( !_object )
return 0;
if( !_object->dataType( DATA_SPLATCLOUD ) )
return 0;
return dynamic_cast<SplatCloudObject *>( _object );
}
//----------------------------------------------------------------
SplatCloudObject* splatCloudObject( int _objectId ) {
if (_objectId == BaseObject::NOOBJECT)
return 0;
// Get object by using the map accelerated plugin function
BaseObjectData* object = 0;
PluginFunctions::getObject(_objectId,object);
if ( object == 0 )
return 0;
SplatCloudObject* splatCloudObject = dynamic_cast< SplatCloudObject* >(object);
return splatCloudObject;
}
//================================================================
} // namespace PluginFunctions
/*===========================================================================*\
* *
* 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 PluginFunctionsSplatCloud.hh
* This file contains functions which can be used by plugins to access splat clouds in the framework
*/
#ifndef PLUGINFUNCTIONSSPLATCLOUD_HH
#define PLUGINFUNCTIONSSPLATCLOUD_HH
//== INCLUDES ====================================================
#include "SplatCloud.hh"
#include <OpenFlipper/common/Types.hh>
//== NAMESPACES ==================================================
/** The Namespace PluginFunctions contains functions for all plugins. */
namespace PluginFunctions {
//== DEFINITIONS =================================================
/** This functions returns the object with the given id if it is a SplatCloudObject.
* See get_object( int _identifier , BaseObject*& _object ) for more details.
*/
OBJECTTYPEDLLEXPORT
bool getObject( int _identifier, SplatCloudObject *&_object );
/** \brief Get a ShaderNode from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
* ShaderNode will be returned. Otherwise a NULL pointer is returned.
*/
OBJECTTYPEDLLEXPORT
ShaderNode* splatShaderNode( BaseObjectData *_object );
/** \brief Get a SplatCloudNode from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
* SplatCloudNode will be returned. Otherwise a NULL pointer is returned.
*/
OBJECTTYPEDLLEXPORT
SplatCloudNode* splatCloudNode( BaseObjectData *_object );
/** \brief Get a SplatCloud from an object.
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
* SplatCloud will be returned. Otherwise a NULL pointer is returned.
*/
OBJECTTYPEDLLEXPORT
SplatCloud* splatCloud( BaseObjectData *_object );
/** \brief Cast an SplatCloudObject to a SplatCloudObject if possible
*
* @param _object The object should be of type BaseDataObject. If the content is a SplatCloud, a
* SplatCloudObject is returned. Otherwise a NULL pointer is returned.
*/
OBJECTTYPEDLLEXPORT
SplatCloudObject* splatCloudObject( BaseObjectData *_object );
/** \brief Get an SplatCloudObject by its id
*
* @param _objectId Id of the object. If the object exists and is a SplatCloud, a
* SplatCloudObject is returned. Otherwise a NULL pointer is returned.
*/
OBJECTTYPEDLLEXPORT
SplatCloudObject* splatCloudObject( int _objectId );
//================================================================
} // namespace PluginFunctions
//================================================================
#endif // PLUGINFUNCTIONSSPLATCLOUD_HH
/*===========================================================================*\
* *
* 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 ObjectTypes/SplatCloud/SplatCloud.hh
* This File contains all required includes for using SplatClouds
*/
#ifndef SPLATCLOUD_INCLUDE_HH
#define SPLATCLOUD_INCLUDE_HH
//== DEFINES =====================================================
/** \def DATA_SPLATCLOUD
* Use this macro to reference Splat Clouds
*/
#define DATA_SPLATCLOUD typeId( "SplatCloud" )
//== INCLUDES ====================================================
#include <ObjectTypes/SplatCloud/SplatCloudObject.hh>
#include <ObjectTypes/SplatCloud/PluginFunctionsSplatCloud.hh>
#include <ObjectTypes/SplatCloud/SplatCloudTypes.hh>
//================================================================
#endif // SPLATCLOUD_INCLUDE_HH
/*===========================================================================*\
* *
* 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$ *
* *
\*===========================================================================*/
//================================================================
//
// CLASS SplatCloud - IMPLEMENTATION
//
//================================================================
//== INCLUDES ====================================================
#include "SplatCloud.hh"
#include <iostream>
//== STATIC MEMBERS ==============================================
const SplatCloud::PositionsHandle SplatCloud::POSITIONS_HANDLE ( "<Positions>" );
const SplatCloud::ColorsHandle SplatCloud::COLORS_HANDLE ( "<Colors>" );
const SplatCloud::NormalsHandle SplatCloud::NORMALS_HANDLE ( "<Normals>" );
const SplatCloud::PointsizesHandle SplatCloud::POINTSIZES_HANDLE( "<Pointsizes>" );
const SplatCloud::IndicesHandle SplatCloud::INDICES_HANDLE ( "<Indices>" );
const SplatCloud::ViewlistsHandle SplatCloud::VIEWLISTS_HANDLE ( "<Viewlists>" );
const SplatCloud::SelectionsHandle SplatCloud::SELECTIONS_HANDLE( "<Selections>" );
//== IMPLEMENTATION ==============================================
void SplatCloud::copySplatProperties( const SplatCloud &_splatCloud )
{
// deep copy all splat-properties
SplatPropertyMap::const_iterator splatPropertyIter;
for( splatPropertyIter = _splatCloud.splatProperties_.begin(); splatPropertyIter != _splatCloud.splatProperties_.end(); ++splatPropertyIter )
{
// create new deep copy of current splat-property
SplatPropertyInterface *prop = splatPropertyIter->second.property_->clone();
// check if out of memory
if( prop == 0 )
{
std::cerr << "Out of memory for a copy of SplatCloud's splat-property \"" << splatPropertyIter->first << "\"." << std::endl;
continue;
}
// insert new property map entry into splat-property map with same name as before
splatProperties_[ splatPropertyIter->first ] = SplatPropertyMapEntry( prop, splatPropertyIter->second.numRequests_ );
}
// Get pointers to predefined splat-properties.
// These can *not* be copied because they have to point to the newly
// created deep copies of the properties and not to the old properties.
getPredefinedSplatPropertyPointers();
}
//----------------------------------------------------------------
void SplatCloud::copyCloudProperties( const SplatCloud &_splatCloud )
{
// deep copy all cloud-properties
CloudPropertyMap::const_iterator cloudPropertyIter;
for( cloudPropertyIter = _splatCloud.cloudProperties_.begin(); cloudPropertyIter != _splatCloud.cloudProperties_.end(); ++cloudPropertyIter )
{
// create new deep copy of current cloud-property
CloudPropertyInterface *prop = cloudPropertyIter->second.property_->clone();
// check if out of memory
if( prop == 0 )
{
std::cerr << "Out of memory for a copy of SplatCloud's cloud-property \"" << cloudPropertyIter->first << "\"." << std::endl;