Skip to content

Commit

Permalink
Merge branch '13-bugfix_merge_from_energidosgqtquick11_caused_build_i…
Browse files Browse the repository at this point in the history
…ssues_on_' into 'master'

Merge from energid/osgqtquick#11 caused build issues on non-windows platforms

Closes podsvirov#13 and podsvirov#11

See merge request energid/osgqtquick!13
  • Loading branch information
Piyoosh Mukhija committed May 3, 2018
2 parents 22a7728 + 95c5eb1 commit 6a46ec7
Show file tree
Hide file tree
Showing 23 changed files with 1,313 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ find_package(OpenSceneGraph 3.0 REQUIRED
osgManipulator
osgUtil
osgViewer
osgShadow
osgText)

# osgQt
Expand Down
2 changes: 2 additions & 0 deletions src/imports/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ add_subdirectory(osgga)
add_subdirectory(osgmanipulator)
add_subdirectory(osgtext)
add_subdirectory(osgviewer)
add_subdirectory(osgshadow)


if(osgQtQuick_WITH_OSGQT)
add_subdirectory(osgqt)
Expand Down
2 changes: 2 additions & 0 deletions src/imports/osgshadow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Module configuration
osgqtquick_imported_module("osgShadow")
19 changes: 19 additions & 0 deletions src/imports/osgshadow/plugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <QtQml/QtQml>

#include <osgShadow/ModuleQtQml>

class osgShadowPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")

public:
void registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("osgShadow"));
// osgShadow types from osgQtQml library
osgShadow::registerQtQmlTypes(uri);
}
};

#include "plugin.moc"
25 changes: 25 additions & 0 deletions src/qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ META_Node(osgManipulator CompositeDragger)
META_Node(osgManipulator TabPlaneDragger)
META_Node(osgManipulator TabBoxDragger)

META_Node(osgShadow ShadowedScene)
META_Node(osgShadow ShadowTechnique)
META_Node(osgShadow ShadowMap)


META_Node(osgText Style)
META_Node(osgText Font)
META_Node(osgText FontImplementation)
Expand Down Expand Up @@ -151,6 +156,14 @@ list(APPEND _srcs
osgga/module.cpp
# osgManipulator
osgmanipulator/module.cpp
#osgShadow
osgshadow/shadowedscene.cpp
osgshadow/shadowedsceneindex.cpp
osgshadow/shadowtechnique.cpp
osgshadow/shadowtechniqueindex.cpp
osgshadow/shadowmap.cpp
osgshadow/shadowmapindex.cpp
osgshadow/module.cpp
# osgText
osgtext/module.cpp
# osgViewer
Expand Down Expand Up @@ -197,6 +210,7 @@ target_link_libraries(osgQtQml
${OSGMANIPULATOR_LIBRARIES}
${OSGTEXT_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGSHADOW_LIBRARIES}
${OSGEARTHUTIL_LIBRARY}
Qt5::Gui
Qt5::Qml)
Expand Down Expand Up @@ -290,6 +304,17 @@ install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgmanipulator/module.hpp"
install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgmanipulator/module.hpp"
DESTINATION "include/osgManipulator" RENAME "ModuleQtQml" COMPONENT ${PROJECT_NAME}-src)

file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/include/osgShadow/ModuleQtQml"
CONTENT "#include \"${CMAKE_CURRENT_LIST_DIR}/osgshadow/module.hpp\"\n")
install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgshadow/module.hpp"
DESTINATION "include/osgShadow" RENAME "ModuleQtQml")
install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgshadow/module.hpp"
DESTINATION "include/osgShadow" RENAME "ModuleQtQml" COMPONENT ${PROJECT_NAME}-hdr)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgshadow/module.hpp"
DESTINATION "include/osgShadow" RENAME "ModuleQtQml" COMPONENT ${PROJECT_NAME}-lib)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/osgshadow/module.hpp"
DESTINATION "include/osgShadow" RENAME "ModuleQtQml" COMPONENT ${PROJECT_NAME}-src)


file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/include/osgText/ModuleQtQml"
CONTENT "#include \"${CMAKE_CURRENT_LIST_DIR}/osgtext/module.hpp\"\n")
Expand Down
19 changes: 16 additions & 3 deletions src/qml/osg/lightsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ void LightSourceQtQml::classBegin
o(this)->setLocalStateSetModes(m_LocalStateSetModes);
}


//------------------------------------------------------------------------------
osg::LightSource* LightSourceQtQml::lightSource
(
)
{
return o(this);
}

//------------------------------------------------------------------------------
const QVariant LightSourceQtQml::light
Expand Down Expand Up @@ -85,7 +91,7 @@ void LightSourceQtQml::setLight
}

//------------------------------------------------------------------------------
const quint16 LightSourceQtQml::localStateSetModes
const int LightSourceQtQml::localStateSetModes
(
)const
{
Expand All @@ -95,7 +101,7 @@ const quint16 LightSourceQtQml::localStateSetModes
//------------------------------------------------------------------------------
void LightSourceQtQml::setLocalStateSetModes
(
const quint16 mode
const int mode
)
{
if(m_LocalStateSetModes == mode)
Expand All @@ -109,4 +115,11 @@ void LightSourceQtQml::setLocalStateSetModes

}


//------------------------------------------------------------------------------
void LightSourceQtQml:: setStateSetModes(StateSetQtQml* stateSet, int mode)
{
o(this)->setStateSetModes(*stateSet->stateSet(), mode);
}

}
17 changes: 12 additions & 5 deletions src/qml/osg/lightsource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
namespace osg {

class LightQtQml;
class LightSource;

///
/// \brief The LightSourceQtQml class wraps the osg::LightSource item/class provided by the
Expand All @@ -42,7 +43,7 @@ class OSGQTQML_EXPORT LightSourceQtQml :
/// \property localStateSetModes for the Light Source.
///
/// \details
Q_PROPERTY(quint16 localStateSetModes READ localStateSetModes WRITE setLocalStateSetModes NOTIFY localStateSetModesChanged)
Q_PROPERTY(int localStateSetModes READ localStateSetModes WRITE setLocalStateSetModes NOTIFY localStateSetModesChanged)


public:
Expand Down Expand Up @@ -72,6 +73,10 @@ class OSGQTQML_EXPORT LightSourceQtQml :
QObject *parent = 0
);

osg::LightSource* lightSource
(
);

///
/// \brief light Getter for light property
/// \return value
Expand All @@ -84,11 +89,13 @@ class OSGQTQML_EXPORT LightSourceQtQml :
/// \brief localStateSetModes Getter for localStateSetModes property
/// \return value
///
const quint16 localStateSetModes
const int localStateSetModes
(
) const;


Q_INVOKABLE void setStateSetModes(StateSetQtQml* stateSet, int mode);


public Q_SLOTS:
///
Expand All @@ -106,7 +113,7 @@ public Q_SLOTS:
///
void setLocalStateSetModes
(
const quint16 mode
const int mode
);


Expand All @@ -126,14 +133,14 @@ public Q_SLOTS:
///
void localStateSetModesChanged
(
const quint16 mode
const int mode
);


protected:

osg::LightQtQml* m_pLightObject;
quint16 m_LocalStateSetModes;
int m_LocalStateSetModes;

};

Expand Down
11 changes: 11 additions & 0 deletions src/qml/osg/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "cylinderindex.hpp"
#include "geodeindex.hpp"

#include "light.hpp"
#include "lightsource.hpp"

#include <osg/Group>

#include <osgQtQml/Object>
Expand Down Expand Up @@ -105,6 +108,14 @@ void registerQtQmlTypes(const char *uri)
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"Cylinder");

qmlRegisterType<LightQtQml>(
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"Light");

qmlRegisterType<LightSourceQtQml>(
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"LightSource");

osgQtQml::Index::insertMake(&qtMakeIndex);
osgQtQml::Index::insertMake(&osgMakeIndex);
}
Expand Down
24 changes: 24 additions & 0 deletions src/qml/osg/osgqtconversion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@

#include <QtCore/qglobal.h>
#include <osg/Vec4>
#include <osg/Vec2d>
#include <osg/Vec3d>
#include <QtGui/QColor>
#include <QtGui/QVector2D>
#include <QtGui/QVector3D>
#include <QtGui/QVector4D>
//#include <boost/numeric/conversion/cast.hpp>
Expand Down Expand Up @@ -60,6 +62,19 @@ namespace OsgQtConversion
return osg::Vec4(vect[0], vect[1], vect[2], vect[3]);
}

///
/// \brief toOsg Converts a vector of QVector4D to equivalent osg vect3d value
/// \param vector QVector4D value.
/// \return osg::Vec3d value.
///
inline /*OSGQTQML_EXPORT*/ osg::Vec2d toOsg
(
const QVector2D &vect
)
{
return osg::Vec2d(vect[0], vect[1]);
}

///
/// \brief toOsg Converts a vector of QVector3D to equivalent osg vect3d value
/// \param vector QVector3D value.
Expand Down Expand Up @@ -109,6 +124,15 @@ namespace OsgQtConversion
{
return QVector4D(vect.x(), vect.y(), vect.z(), vect.w());
}

/// \brief Returns a QVector4D by value for given osg::Vec4.
inline /*OSGQTQML_EXPORT*/ QVector2D toQt
(
const osg::Vec2d& vect
)
{
return QVector2D(vect.x(), vect.y());
}
}

#endif // OSGQTCONVERSION_H
35 changes: 35 additions & 0 deletions src/qml/osgshadow/module.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "module.hpp"

#include "shadowedscene.hpp"
#include "shadowtechnique.hpp"
#include "shadowmap.hpp"

#include <osgQtQuick/Version>
#include <QtQml/QtQml>

#include <QtCore/QDebug>

namespace osgShadow {

void registerQtQmlTypes(const char *uri)


{

qmlRegisterType<ShadowedSceneQtQml>(
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"ShadowedScene");

qmlRegisterType<ShadowMapQtQml>(
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"ShadowMap");

qmlRegisterUncreatableType<ShadowTechniqueQtQml>(
uri, osgQtQuick_VERSION_MAJOR, osgQtQuick_VERSION_MINOR,
"ShadowTechnique", "[osgQtQuick] ShadowTechnique is Uncreatable");



}

}
12 changes: 12 additions & 0 deletions src/qml/osgshadow/module.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _OSGSHADOW_MODULE_QTQML_
#define _OSGSHADOW_MODULE_QTQML_ 1

#include <osgQtQml/Export>

namespace osgShadow {

OSGQTQML_EXPORT void registerQtQmlTypes(const char *uri);

}

#endif // _OSGSHADOW_MODULE_QTQML_
Loading

0 comments on commit 6a46ec7

Please sign in to comment.