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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef SPLATCLOUD_EXTENSIONS_HH
#define SPLATCLOUD_EXTENSIONS_HH
#include <ObjectTypes/SplatCloud/SplatCloud.hh>
#include <OpenFlipper/common/Types.hh>
#include <string>
#include <vector>
#include <bitset>
class SplatCloud_Projection
{
public:
SplatCloud_Projection() : f_( 0.0 ), k1_( 0.0 ), k2_( 0.0 )
{
r_[0][0] = 1.0; r_[0][1] = 0.0; r_[0][2] = 0.0;
r_[1][0] = 0.0; r_[1][1] = 1.0; r_[1][2] = 0.0;
r_[2][0] = 0.0; r_[2][1] = 0.0; r_[2][2] = 1.0;
t_ [0] = 0.0; t_ [1] = 0.0; t_ [2] = 0.0;
}
public:
double f_, k1_, k2_;
double r_[3][3];
double t_[3];
};
class SplatCloud_Camera
{
public:
SplatCloud_Camera() : objectId_( -1 ), projection_(), imagePath_( "" ), imageWidth_( 0 ), imageHeight_( 0 ) { }
public:
int objectId_;
SplatCloud_Projection projection_;
std::string imagePath_;
unsigned int imageWidth_, imageHeight_;
};
class SplatCloud_Surface
{
public:
SplatCloud_Surface() : firstSplatIdx_( -1 ), numSplats_( 0 ) { }
public:
int firstSplatIdx_;
unsigned int numSplats_;
};
class SplatCloud_Quad
{
public:
SplatCloud_Quad()
{
vertices_[0] = ACG::Vec3d( 0.0, 0.0, 0.0 );
vertices_[1] = ACG::Vec3d( 0.0, 0.0, 0.0 );
vertices_[2] = ACG::Vec3d( 0.0, 0.0, 0.0 );
vertices_[3] = ACG::Vec3d( 0.0, 0.0, 0.0 );
}
public:
ACG::Vec3d vertices_[4];
};
class SplatCloud_Cluster
{
public:
SplatCloud_Cluster() : surface_(), quad_() { }
public:
SplatCloud_Surface surface_;
SplatCloud_Quad quad_;
};
typedef std::vector<SplatCloud_Camera> SplatCloud_Cameras;
typedef std::vector<SplatCloud_Cluster> SplatCloud_Clusters;
typedef std::bitset<8> SplatCloud_Flags;
class SplatCloud_CameraManager
{
public:
SplatCloud_CameraManager() : cameras_() { }
public:
SplatCloud_Cameras cameras_;
};
class SplatCloud_ClusterManager
{
public:
SplatCloud_ClusterManager() : objectId_( -1 ), unclustered_(), clusters_() { }
public:
int objectId_;
SplatCloud_Surface unclustered_;
SplatCloud_Clusters clusters_;
};
class SplatCloud_GeneralManager
{
public:
SplatCloud_GeneralManager() : flags_( 0 ) { }
public:
SplatCloud_Flags flags_;
};
typedef SplatCloud::CloudPropertyT<SplatCloud_CameraManager> SplatCloud_CameraManagerProperty;
typedef SplatCloud::CloudPropertyT<SplatCloud_ClusterManager> SplatCloud_ClusterManagerProperty;
typedef SplatCloud::CloudPropertyT<SplatCloud_GeneralManager> SplatCloud_GeneralManagerProperty;
static const SplatCloud::PropertyHandleT<SplatCloud_CameraManager> SPLATCLOUD_CAMERAMANAGER_HANDLE ( "CameraManager" );
static const SplatCloud::PropertyHandleT<SplatCloud_ClusterManager> SPLATCLOUD_CLUSTERMANAGER_HANDLE( "ClusterManager" );
static const SplatCloud::PropertyHandleT<SplatCloud_GeneralManager> SPLATCLOUD_GENERALMANAGER_HANDLE( "GeneralManager" );
static const unsigned int SPLATCLOUD_CAMERA_HAS_IMAGEPATH_FLAG = 0;
static const unsigned int SPLATCLOUD_CAMERA_HAS_IMAGERESOLUTION_FLAG = 1;
static const unsigned int SPLATCLOUD_SPLAT_VIEWLIST_HAS_FEATURE_INDICES_FLAG = 2;
static const unsigned int SPLATCLOUD_SPLAT_VIEWLIST_COORDS_NORMALIZED_FLAG = 3;
static const unsigned int SPLATCLOUD_CLUSTER_HAS_QUAD_FLAG = 4;
#endif // SPLATCLOUD_EXTENSIONS_HH
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
//
//================================================================
/**