/* * osgART/VideoBillboard * osgART: AR ToolKit for OpenSceneGraph * * Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved. * * Rev Date Who Changes * 1.0 2006-12-08 --- Version 1.0 release. * */ /* * This file is part of osgART - AR Toolkit for OpenSceneGraph * * Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved. * * (See the AUTHORS file in the root of this distribution.) * * * OSGART is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * OSGART 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OSGART; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "osgART/VideoBillboard" #include "osgART/VideoTexture" #include "osgART/VideoManager" #include "osgART/VideoTextureRectangle" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace osgART { VideoBillboard::VideoBillboard(GenericVideo* video) : VideoPlane(video) { } VideoBillboard::~VideoBillboard() { } osg::Node* VideoBillboard::buildObject() { osg::MatrixTransform* modelview = new osg::MatrixTransform(); modelview->setMatrix(osg::Matrix::identity()); // modelview->setReferenceFrame(osg::Transform::ABSOLUTE_RF); //osg::Depth* depth = new osg::Depth; //depth->setFunction(osg::Depth::ALWAYS); //depth->setRange(1.0, 1.0); osg::StateSet* backgroundStateSet = new osg::StateSet(); backgroundStateSet->setRenderBinDetails(1, "RenderBin"); //backgroundStateSet->setAttribute(depth); osg::Group* backgroundGroup = new osg::Group(); backgroundGroup->setStateSet(backgroundStateSet); osg::AutoTransform* billboardTransform = new osg::AutoTransform; billboardTransform->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); billboardTransform->addChild(buildGeometry()); backgroundGroup->addChild(billboardTransform); modelview->addChild(backgroundGroup); return modelview; } };