Commit 7fac872d authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[MERGE]

parents a813552e 674771d0
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
FILE( GLOB KERNEL_SRC "*.cpp" )
ADD_LIBRARY( kernel SHARED ${KERNEL_SRC} )
TARGET_LINK_LIBRARIES( kernel common )
TARGET_LINK_LIBRARIES( kernel common ge )
# Unit tests
......@@ -11,5 +11,6 @@ IF( CXXTEST_FOUND )
"WKernel.cpp"
"WModule.cpp"
"WTestModule.cpp"
"WNavigationSliceModule.cpp"
)
ENDIF( CXXTEST_FOUND )
......@@ -31,6 +31,7 @@
#include "WKernel.h"
#include "WModule.h"
#include "WTestModule.h"
#include "WNavigationSliceModule.h"
#include "../common/WException.h"
#include "../graphicsEngine/WGraphicsEngine.h"
......@@ -143,7 +144,7 @@ void WKernel::loadModules()
std::cout << "Loading modules:" << std::endl;
m_modules.clear();
WModule* m = new WTestModule();
WModule* m = new WNavigationSliceModule();
std::cout << "Loading Module: " << m->getName() << std::endl;
m_modules.push_back( m );
......@@ -175,3 +176,8 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
m_DataHandler->loadDataSets( fileNames );
}
boost::shared_ptr<WDataHandler> WKernel::getDataHandler()
{
return m_DataHandler;
}
......@@ -117,6 +117,12 @@ public:
*/
void doLoadDataSets( std::vector< std::string > fileNames );
/**
*
*/
boost::shared_ptr<WDataHandler> getDataHandler();
protected:
/**
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <osg/ShapeDrawable>
#include <osg/Group>
#include <osg/Geode>
#include <osg/Geometry>
#include "WNavigationSliceModule.h"
#include "WKernel.h"
WNavigationSliceModule::WNavigationSliceModule():
WModule()
{
// initialize members
}
WNavigationSliceModule::~WNavigationSliceModule()
{
// cleanup
}
WNavigationSliceModule::WNavigationSliceModule( const WNavigationSliceModule& other )
: WModule()
{
*this = other;
}
const std::string WNavigationSliceModule::getName() const
{
return "Test Module";
}
const std::string WNavigationSliceModule::getDescription() const
{
return "This module is for testing and development";
}
void WNavigationSliceModule::threadMain()
{
createSlices();
// Since the modules run in a separate thread: such loops are possible
while ( !m_FinishRequested )
{
// do fancy stuff
sleep( 1 );
}
// clean up stuff
}
void WNavigationSliceModule::createSlices()
{
osg::Geode* sliceGeode = new osg::Geode();
osg::Geometry* sliceGeometry = new osg::Geometry();
sliceGeode->addDrawable( sliceGeometry );
osg::Vec3Array* sliceVertices = new osg::Vec3Array;
sliceVertices->push_back( osg::Vec3( 0, 50, 0 ) );
sliceVertices->push_back( osg::Vec3( 0, 50, 100 ) );
sliceVertices->push_back( osg::Vec3( 100, 50, 100 ) );
sliceVertices->push_back( osg::Vec3( 100, 50, 0 ) );
sliceVertices->push_back( osg::Vec3( 50, 0, 0 ) );
sliceVertices->push_back( osg::Vec3( 50, 0, 100 ) );
sliceVertices->push_back( osg::Vec3( 50, 100, 100 ) );
sliceVertices->push_back( osg::Vec3( 50, 100, 0 ) );
sliceVertices->push_back( osg::Vec3( 0, 0, 50 ) );
sliceVertices->push_back( osg::Vec3( 0, 100, 50 ) );
sliceVertices->push_back( osg::Vec3( 100, 100, 50 ) );
sliceVertices->push_back( osg::Vec3( 100, 0, 50 ) );
sliceGeometry->setVertexArray( sliceVertices );
osg::Vec3Array* texCoords = new osg::Vec3Array;
texCoords->push_back( osg::Vec3( 0.0, 0.5, 0.0 ) );
texCoords->push_back( osg::Vec3( 0.0, 0.5, 1.0 ) );
texCoords->push_back( osg::Vec3( 1.0, 0.5, 1.0 ) );
texCoords->push_back( osg::Vec3( 1.0, 0.5, 0.0 ) );
texCoords->push_back( osg::Vec3( 0.5, 0.0, 0.0 ) );
texCoords->push_back( osg::Vec3( 0.5, 0.0, 1.0 ) );
texCoords->push_back( osg::Vec3( 0.5, 1.0, 1.0 ) );
texCoords->push_back( osg::Vec3( 0.5, 1.0, 0.0 ) );
texCoords->push_back( osg::Vec3( 0.0, 0.0, 0.5 ) );
texCoords->push_back( osg::Vec3( 0.0, 1.0, 0.5 ) );
texCoords->push_back( osg::Vec3( 1.0, 1.0, 0.5 ) );
texCoords->push_back( osg::Vec3( 1.0, 0.0, 0.5 ) );
sliceGeometry->setTexCoordArray( 0, texCoords );
osg::DrawElementsUInt* slice0 = new osg::DrawElementsUInt( osg::PrimitiveSet::QUADS, 0 );
slice0->push_back( 3 );
slice0->push_back( 2 );
slice0->push_back( 1 );
slice0->push_back( 0 );
osg::DrawElementsUInt* slice1 = new osg::DrawElementsUInt( osg::PrimitiveSet::QUADS, 0 );
slice1->push_back( 7 );
slice1->push_back( 6 );
slice1->push_back( 5 );
slice1->push_back( 4 );
osg::DrawElementsUInt* slice2 = new osg::DrawElementsUInt( osg::PrimitiveSet::QUADS, 0 );
slice2->push_back( 11 );
slice2->push_back( 10 );
slice2->push_back( 9 );
slice2->push_back( 8 );
sliceGeometry->addPrimitiveSet( slice0 );
sliceGeometry->addPrimitiveSet( slice1 );
sliceGeometry->addPrimitiveSet( slice2 );
WKernel::getRunningKernel()->getGraphicsEngine()->getScene()->addChild( sliceGeode );
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut
//
// Copyright 2009 SomeCopyrightowner
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WNAVIGATIONSLICEMODULE_H
#define WNAVIGATIONSLICEMODULE_H
#include <string>
#include "WModule.h"
/**
* \par Description:
* Simple module for testing some WKernel functionality.
*/
class WNavigationSliceModule: public WModule
{
public:
/**
* \par Description
* Default constructor.
*/
WNavigationSliceModule();
/**
* \par Description
* Destructor.
*/
virtual ~WNavigationSliceModule();
/**
* \par Description
* Copy constructor
* \param other Reference on object to copy.
*/
WNavigationSliceModule( const WNavigationSliceModule& other );
/**
* \par Description
* Gives back the name of this module.
* \return the module's name.
*/
virtual const std::string getName() const;
/**
* \par Description
* Gives back a description of this module.
* \return description to module.
*/
virtual const std::string getDescription() const;
protected:
/**
* \par Description
* Entry point after loading the module. Runs in separate thread.
*/
virtual void threadMain();
private:
/**
*
*/
void createSlices();
};
#endif // WNAVIGATIONSLICEMODULE_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment