• 大小: 1.89MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-01
  • 语言: 其他
  • 标签: osg  源码  source  实践  

资源简介

OpenSceneGraph三维渲染引擎设计与实践一书的源码,造福社区 0积分下载. 冲鸭程序员们,源码亲测可用,希望给个好评

资源截图

代码片段和文件信息

/* -*-c++-*- Copyright (C) 2009 Wang Rui 
 * OpenSceneGraph Engine Book - Design and Implementation
 * How to create a billboard forest
*/

#include 
#include 
#include 
#include 

#define RAND(min max) ((min) + (double)rand()/(RAND_MAX+1)*((max)-(min)))

void createTrees( osg::Billboard& root )
{
    root.getOrCreateStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
    root.getOrCreateStateSet()->setMode( GL_LIGHTING osg::StateAttribute::OFF );
    
    osg::ref_ptr texture = new osg::Texture2D( osgDB::readImageFile(“tree.rgba“) );
    for ( unsigned int i=0; i<200; ++i )
    {
        osg::ref_ptr tree =
            osg::createTexturedQuadGeometry( osg::Vec3(000) osg::Vec3(RAND(0.51.5)00) osg::Vec3(00RAND(1.02.0)) );
        tree->getOrCreateStateSet()->setTextureAttributeAndModes( 0 texture.get() );
        
        root.addDrawable( tree.get() osg::Vec3(RAND(-1010) RAND(-1010) 0.0) );
    }
}

int main( int argc char** argv )
{
    osg::ref_ptr treeGeode = new osg::Billboard;
    treeGeode->setMode( osg::Billboard::POINT_ROT_EYE );
    createTrees( *treeGeode );
    
    osgViewer::Viewer viewer;
    viewer.setSceneData( treeGeode.get() );
    return viewer.run();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......      1399  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\billboard\billboard.cpp

    .......       571  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\billboard\CMakeLists.txt

    .......      1523  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\birdseye\birdseye.cpp

    .......       640  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\birdseye\CMakeLists.txt

    .......      1272  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\bitmap\bitmap.cpp

    .......       640  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\bitmap\CMakeLists.txt

    .......      2078  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\callback\callback.cpp

    .......       642  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\callback\CMakeLists.txt

    .......      2442  2009-11-22 08:56  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeLists.txt

    .......      2173  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\CustomModules.cmake

    .......      4182  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindOpenGL.cmake

    .......      1634  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\Findosg.cmake

    .......      1596  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgAnimation.cmake

    .......      1505  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgDB.cmake

    .......      1501  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgFX.cmake

    .......      1513  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgGA.cmake

    .......      1685  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgIntrospection.cmake

    .......      1661  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgManipulator.cmake

    .......      1595  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgParticle.cmake

    .......      1565  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgShadow.cmake

    .......      1513  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgSim.cmake

    .......      1571  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgTerrain.cmake

    .......      1511  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgText.cmake

    .......      1521  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgUtil.cmake

    .......      1551  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgViewer.cmake

    .......      1551  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgVolume.cmake

    .......      1602  2009-09-22 00:13  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\CMakeModules\FindosgWidget.cmake

    .......      5437  2009-11-22 08:41  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\data\0.JPG

    .......      3343  2009-11-22 08:41  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\data\1.JPG

    .......      5681  2009-11-22 08:41  OpenSceneGraph三维渲染引擎设计与实践_source\Examples\data\2.JPG

............此处省略138个文件信息

评论

共有 条评论