*** empty log message ***
This commit is contained in:
@@ -15,5 +15,13 @@ EXEC = osgcameragroup
|
||||
INC += $(PRODUCER_INCLUDE_DIR) -I/usr/X11R6/include -I/usr/X11R6/include
|
||||
LDFLAGS += $(PRODUCER_LIB_DIR) -L/usr/X11R6/lib
|
||||
|
||||
|
||||
ifeq ($(USE_OPEN_THREAD),1)
|
||||
DEF += -D_USE_OPEN_THREAD
|
||||
INC += $(INC_OPEN_THREAD)
|
||||
LDFLAGS += $(LIB_OPEN_THREAD)
|
||||
LIBS += -lOpenThread
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/Make/makerules
|
||||
|
||||
|
||||
@@ -149,10 +149,10 @@ int main( int argc, char **argv )
|
||||
|
||||
const osg::BoundingSphere& bs = loadedModel->getBound();
|
||||
|
||||
Producer::Trackball tb;
|
||||
tb.setOrientation( Producer::Trackball::Z_UP );
|
||||
tb.setDistance(bs.radius()*3.0f);
|
||||
tb.translate(-bs.center().x(),-bs.center().y(),-bs.center().z());
|
||||
osg::ref_ptr<Producer::Trackball> tb = new Producer::Trackball;
|
||||
tb->setOrientation( Producer::Trackball::Z_UP );
|
||||
tb->setDistance(bs.radius()*3.0f);
|
||||
tb->translate(-bs.center().x(),-bs.center().y(),-bs.center().z());
|
||||
|
||||
// create the windows and run the threads.
|
||||
cg.realize();
|
||||
@@ -168,10 +168,10 @@ int main( int argc, char **argv )
|
||||
// call all node update callbacks and animations.
|
||||
cg.getSceneData()->accept(update);
|
||||
|
||||
tb.input( kbmcb.mx(), kbmcb.my(), kbmcb.mbutton() );
|
||||
tb->input( kbmcb.mx(), kbmcb.my(), kbmcb.mbutton() );
|
||||
|
||||
// update the main producer camera
|
||||
cg.setViewByMatrix(tb.getMatrix());
|
||||
cg.setViewByMatrix(tb->getMatrix());
|
||||
|
||||
// fire off the cull and draw traversals of the scene.
|
||||
cg.frame();
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
#include <osgUtil/Optimizer>
|
||||
|
||||
#include "OrientationConverter.h"
|
||||
#include "GeoSet.h"
|
||||
|
||||
@@ -273,6 +275,10 @@ int main( int argc, char **argv )
|
||||
ConvertGeoSetsToGeometryVisitor cgtg;
|
||||
root->accept(cgtg);
|
||||
|
||||
// optimize the scene graph, remove rendundent nodes and state etc.
|
||||
osgUtil::Optimizer optimizer;
|
||||
optimizer.optimize(root.get());
|
||||
|
||||
|
||||
if( do_convert )
|
||||
root = oc.convert( root.get() );
|
||||
|
||||
@@ -35,8 +35,17 @@ osg::Node* createHUD()
|
||||
// turn lighting off for the text and disable depth test to ensure its always ontop.
|
||||
osg::StateSet* stateset = geode->getOrCreateStateSet();
|
||||
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
|
||||
//stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||
|
||||
#if 0
|
||||
// to ensure the hud appears on top we can either use osg::Depth to force the
|
||||
// depth fragments to be placed at the front of the screen.
|
||||
stateset->setAttribute(new osg::Depth(osg::Depth::LESS,0.0,0.0001));
|
||||
#else
|
||||
// or disable depth test, and make sure that the hud is drawn after everything
|
||||
// else so that it always appears ontop.
|
||||
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
|
||||
stateset->setRenderBinDetails(11,"RenderBin");
|
||||
#endif
|
||||
|
||||
osg::Vec3 position(150.0f,800.0f,0.0f);
|
||||
osg::Vec3 delta(0.0f,-120.0f,0.0f);
|
||||
|
||||
@@ -356,7 +356,7 @@ int main( int argc, char **argv )
|
||||
++itr)
|
||||
{
|
||||
// switch off small feature culling to prevent the light points from being culled.
|
||||
osgUtil::SceneView* sceneview = itr->get();
|
||||
osgUtil::SceneView* sceneview = (*itr)->getSceneView();
|
||||
sceneview->setCullingMode( sceneview->getCullingMode() & ~osg::CullStack::SMALL_FEATURE_CULLING);
|
||||
}
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ int main( int argc, char **argv )
|
||||
itr!=viewer.getSceneHandlerList().end();
|
||||
++itr)
|
||||
{
|
||||
osgUtil::SceneView* sceneview = itr->get();
|
||||
osgUtil::SceneView* sceneview = (*itr)->getSceneView();
|
||||
sceneview->setCullMask(0xffffffff);
|
||||
sceneview->setCullMaskLeft(0x00000001);
|
||||
sceneview->setCullMaskRight(0x00000002);
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/Geode>
|
||||
|
||||
#include <osg/Group>
|
||||
#include <osg/Projection>
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#include <osgText/Text>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
@@ -137,18 +137,14 @@ osg::Node* createRectangle(osg::BoundingBox& bb,
|
||||
// disable display list so our modified tex coordinates show up
|
||||
geom->setUseDisplayList(false);
|
||||
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->addDrawable(geom);
|
||||
|
||||
// setup texture
|
||||
osg::TextureRectangle* texture = new osg::TextureRectangle;
|
||||
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
|
||||
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
|
||||
|
||||
// load image
|
||||
osg::Image* img = osgDB::readImageFile(filename);
|
||||
texture->setImage(img);
|
||||
|
||||
|
||||
// setup state
|
||||
osg::StateSet* state = geom->getOrCreateStateSet();
|
||||
state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
|
||||
|
||||
@@ -156,6 +152,8 @@ osg::Node* createRectangle(osg::BoundingBox& bb,
|
||||
state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
|
||||
// install 'update' callback
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->addDrawable(geom);
|
||||
geode->setUpdateCallback(new TexturePanCallback(geom, img));
|
||||
|
||||
return geode;
|
||||
@@ -190,17 +188,17 @@ osg::Node* createHUD()
|
||||
state->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
|
||||
|
||||
// add text
|
||||
osg::Vec3 pos(150.0f, 800.0f, 0.0f);
|
||||
osg::Vec3 pos(120.0f, 800.0f, 0.0f);
|
||||
const osg::Vec3 delta(0.0f, -80.0f, 0.0f);
|
||||
|
||||
const char* text[] = {
|
||||
"TextureRectangle Mini-HOWTO",
|
||||
"- essentially behaves like Texture2D, *except* that:",
|
||||
"- tex coords must be non-normalized (0..width) instead of (0..1)",
|
||||
"- wrap mode must be CLAMP, CLAMP_TO_EDGE, or CLAMP_TO_BORDER",
|
||||
"- repeating wrap modes are *not* supported",
|
||||
"- texture border is *not* supported",
|
||||
"- texture mipmaps are *not* supported",
|
||||
"- tex coords must be non-normalized (0..pixel) instead of (0..1)",
|
||||
"- wrap modes must be CLAMP, CLAMP_TO_EDGE, or CLAMP_TO_BORDER\n repeating wrap modes are not supported",
|
||||
"- filter modes must be NEAREST or LINEAR since\n mipmaps are not supported",
|
||||
"- texture borders are not supported",
|
||||
"- defaults should be fine",
|
||||
NULL
|
||||
};
|
||||
const char** t = text;
|
||||
@@ -226,9 +224,11 @@ osg::Node* createHUD()
|
||||
osg::Node* createModel(const std::string& filename)
|
||||
{
|
||||
osg::Group* root = new osg::Group;
|
||||
|
||||
osg::BoundingBox bb(0.0f,0.0f,0.0f,1.0f,1.0f,1.0f);
|
||||
root->addChild(createRectangle(bb, filename)); // XXX
|
||||
|
||||
if (filename != "X") {
|
||||
osg::BoundingBox bb(0.0f,0.0f,0.0f,1.0f,1.0f,1.0f);
|
||||
root->addChild(createRectangle(bb, filename)); // XXX
|
||||
}
|
||||
|
||||
root->addChild(createHUD());
|
||||
|
||||
|
||||
@@ -13,6 +13,43 @@
|
||||
#include <osgUtil/Optimizer>
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
|
||||
#if 0
|
||||
enum Methods
|
||||
{
|
||||
SET_1,
|
||||
SET_2,
|
||||
END
|
||||
};
|
||||
|
||||
|
||||
typedef std::pair<Methods,std::string> MethodPair;
|
||||
|
||||
class Proxy
|
||||
{
|
||||
public:
|
||||
Proxy(MethodPair* methods)
|
||||
{
|
||||
std::cout<<"methods "<<methods<<std::endl;
|
||||
for(int i=0;methods[i].first!=END;++i)
|
||||
{
|
||||
std::cout<<"\t"<<methods[i].first<<"\t"<<methods[i].second<<std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static MethodPair methods[] =
|
||||
{
|
||||
MethodPair(SET_1,"SET_1"),
|
||||
MethodPair(SET_2,"SET_2"),
|
||||
MethodPair(END,"")
|
||||
};
|
||||
|
||||
Proxy myproxy(methods);
|
||||
|
||||
#endif
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user