我要发帖 回复

正式会员

15

主题

96

积分

0

专家分

:

私信
发表时间 : 2010-4-12 21:37:40 | 浏览 : 1457    评论 : 14
第二步:添加files
Step 1 选择Project-》Add Existing Item
Step 2 找到tornado.cpp,将该文件放在项目所在目录。
第三步:配置project
Step 1 选择Projects-》Properties
Step 2 在Properties属性列表里,在Configuration下拉列表中选择All Configurations :
Step 3 选择C/C++标签 Step 4 点击Code Generation
Step 5 在runtime library右侧下拉列表中选择Multi-threaded DLL(/MD)

这个是教程的方法,我想请问的是第二步中的“找到tornado.cpp,将该文件放在项目所在目录。”,这个CPP是由LP输出的吗?也就是在LP中点击file,然后Export cpp file.但这个输出的CPP和我在教程中的tornado.cpp完全不一样,请问这个是为什么啊

最近VR访客

jgy86324 评论于2010-4-12 23:01:51
大侠们解释一下嘛,困惑中,自己在LP中做的东西,在vs2003上没有显示啊。。。。
sichuanwww 评论于2010-4-13 07:54:03
导出的CPP包含MAIN函数,直接配置运行。研究透了再改造。
努力挣钱,快乐生活!
jgy86324 评论于2010-4-13 12:27:59
大侠们解释一下嘛,困惑中,自己在LP中做的东西,在vs2003上没有显示啊。。。。 ...
jgy86324 发表于 2010-4-12 11:01 PM



    我按照例子做的tornado.acf,用LP生成的.CPP和文档提供的.CPP完全不一样,除了主函数以外,这个又是为什么呢?我主要是想在LP下实现一些我用LP就能够实现的东西,然后在编程实现LP不能够实现的东西,这样我可以省下很多时间
sichuanwww 评论于2010-4-13 12:45:10
有什么不一样?  都在DEFINE函数里面。
努力挣钱,快乐生活!
jgy86324 评论于2010-4-13 18:59:49
我按照例子做的tornado.acf,用LP生成的.CPP和文档提供的.CPP完全不一样,除了主函数以外,这个又是 ...
jgy86324 发表于 2010-4-13 12:27 PM


这是例子文档中的vp_pixel_buffer例子,以下是文档中的自带的源代码

    #include <vuAllocTracer.h>
#include <vpApp.h>
#include <vpObject.h>

// track memory leaks
vuAllocTracer m_allocTracer;

class myApp : public vpApp
{
public:

    /**
     * Constructor
     */
    myApp() {}

    /**
     * Destructor
     */
    ~myApp()
    {
        // Unreference member variables which cache Vega Prime class instances
    }

    /**
     * Configures the Vega Prime system and classes.
     */
    virtual int configure()
    {
        // pre-configuration

        // configure vega prime system first
        vpApp::configure();

        //
        // Get the pixel buffer window by name...
        //

        vpWindow *m_pPixelBufferWindow = vpWindow::find( "myPixelBuffer" );
        assert( m_pPixelBufferWindow );

        //
        // Get town by name and access to its billboard texture so we can
        // modify it to be a dynamic texture by assigning our pixel buffer
        // window to it.
        //

        vpObject *m_pTown = vpObject::find( "town" );
        assert( m_pTown );

        vpGeometry::iterator_texture itt  = m_pTown->begin_texture();
        vpGeometry::iterator_texture itte = m_pTown->end_texture();

        for( ; itt != itte; ++itt )
        {
            if( strcmp( (*itt)->getName(), "vega.rgb" ) == 0 )
            {
                (*itt)->setPixelBuffer(
                    m_pPixelBufferWindow->getDrawContext()->getPixelBuffer() );
            }
        }

        return vsgu::SUCCESS;
    }
};

int main(int argc, char *argv[])
{
    // initialize vega prime
    vp::initialize(argc, argv);

    // create my app instance
    myApp *app = new myApp;

    // load the acf file
    if (argc <= 1)
        app->define("vp_pixel_buffer.acf");
    else app->define(argv[1]);

    // configure my app
    app->configure();

    // execute the main runtime loop
    app->run();

    // delete my app instance
    app->unref();

    // shutdown vega prime
    vp::shutdown();

    return 0;
}
jgy86324 评论于2010-4-13 19:01:34
这是LP生成的源代码:
//
// This file was automatically generated from C:/Program Files/MultiGen-Paradigm/resources/samples/vegaprime/vp/vp_pixel_buffer/vp_pixel_buffer.acf
//
#include "vpModule.h"
#include "vpKernel.h"
#include "vpSearchPath.h"
#include "vpPipeline.h"
#include "vpWindow.h"
#include "vpChannel.h"
#include "vpObserver.h"
#include "vpScene.h"
#include "vpObject.h"
#include "vpRecyclingService.h"
#include "vpEnv.h"
#include "vpEnvSun.h"
#include "vpEnvMoon.h"
#include "vpEnvSkyDome.h"
#include "vpEnvCloudLayer.h"
#include "vpEnvWind.h"
#include "vpMotionGame.h"
#include "vpMotionUFO.h"
#include "vpMotionTetherSpin.h"
#include "vpApp.h"

//
// Define a static list to hold the instances we create, so that we
// can unref them when unconfigure is called
//
typedef vuVector< vuField< vuBase* > > InstancesList;
static InstancesList* s_pInstancesToUnref = NULL;



void define( void )
{
    // Create static instances list that we use to track what we create
    s_pInstancesToUnref = new InstancesList;

    //
    // Initialize all modules
    //

    vpModule::initializeModule( "vpEnv" );
    vpModule::initializeModule( "vpMotion" );


    //
    // Create all instances
    //

    vpKernel* pKernel_myKernel = vpKernel::instance();
    pKernel_myKernel->setNotifyLevel( vuNotify::LEVEL_WARN );
    pKernel_myKernel->setNotifyColorEnable( false );
    pKernel_myKernel->setPriority( vuThread::PRIORITY_NORMAL );
    pKernel_myKernel->setProcessor( -1 );
    pKernel_myKernel->setFrameRateLimiterEnable( true );
    pKernel_myKernel->setDesiredFrameRate( 0.000000 );
    pKernel_myKernel->setNotifyClassTypeMode( vuNotify::CLASS_TYPE_MODE_INCLUSIVE );

    vpSearchPath* pSearchPath_mySearchPath = vpSearchPath::instance();
    pSearchPath_mySearchPath->append( "$(MPI_INSTALL_RESOURCE_DEFAULT)/resources/data/databases/town" );
    pSearchPath_mySearchPath->append( "$(MPI_INSTALL_RESOURCE_DEFAULT)/resources/data/models/hmmwv" );
    pSearchPath_mySearchPath->append( "$(MPI_INSTALL_RESOURCE_DEFAULT)/resources/data/textures" );
    pSearchPath_mySearchPath->append( "/" );

    vpPipeline* pPipeline_myPipeline = new vpPipeline();
    pPipeline_myPipeline->setName( "myPipeline" );
    pPipeline_myPipeline->setMultiThread( vsPipeline::MULTITHREAD_INLINE );
    pPipeline_myPipeline->setId( 0 );
    pPipeline_myPipeline->setNumCullThreads( 0 );
    pPipeline_myPipeline->setCullThreadPriority( vuThread::PRIORITY_NORMAL );
    pPipeline_myPipeline->setCullThreadProcessor( -1 );
    pPipeline_myPipeline->setDrawThreadPriority( vuThread::PRIORITY_NORMAL );
    pPipeline_myPipeline->setDrawThreadProcessor( -1 );
    pPipeline_myPipeline->setBeginFrameOnVsyncEnable( false );
    pPipeline_myPipeline->setDesiredPostDrawTime( -1.000000 );

    s_pInstancesToUnref->push_back( pPipeline_myPipeline );

    vpWindow* pWindow_myPixelBuffer = new vpWindow();
    pWindow_myPixelBuffer->setName( "myPixelBuffer" );
    pWindow_myPixelBuffer->setLabel( "" );
    pWindow_myPixelBuffer->setOrigin( 0 ,  0 );
    pWindow_myPixelBuffer->setSize( 256 ,  256 );
    pWindow_myPixelBuffer->setFullScreenEnable( false );
    pWindow_myPixelBuffer->setBorderEnable( false );
    pWindow_myPixelBuffer->setInputEnable( false );
    pWindow_myPixelBuffer->setCursorEnable( false );
    pWindow_myPixelBuffer->setStereoEnable( false );
    pWindow_myPixelBuffer->setNumColorBits( 8 );
    pWindow_myPixelBuffer->setNumAlphaBits( 0 );
    pWindow_myPixelBuffer->setNumDepthBits( 24 );
    pWindow_myPixelBuffer->setNumStencilBits( 0 );
    pWindow_myPixelBuffer->setNumAccumColorBits( 0 );
    pWindow_myPixelBuffer->setNumAccumAlphaBits( 0 );
    pWindow_myPixelBuffer->setNumMultiSampleBits( 0 );
    pWindow_myPixelBuffer->setSwapInterval( 1 );
    pWindow_myPixelBuffer->setPixelBufferMode( vrDrawContext::PIXEL_BUFFER_MODE_DYNAMIC_TEXTURE );

    s_pInstancesToUnref->push_back( pWindow_myPixelBuffer );

    vpWindow* pWindow_myWindow = new vpWindow();
    pWindow_myWindow->setName( "myWindow" );
    pWindow_myWindow->setLabel( "" );
    pWindow_myWindow->setOrigin( 1 ,  1 );
    pWindow_myWindow->setSize( 1024 ,  768 );
    pWindow_myWindow->setFullScreenEnable( false );
    pWindow_myWindow->setBorderEnable( true );
    pWindow_myWindow->setInputEnable( true );
    pWindow_myWindow->setCursorEnable( true );
    pWindow_myWindow->setStereoEnable( false );
    pWindow_myWindow->setNumColorBits( 8 );
    pWindow_myWindow->setNumAlphaBits( 0 );
    pWindow_myWindow->setNumDepthBits( 24 );
    pWindow_myWindow->setNumStencilBits( 0 );
    pWindow_myWindow->setNumAccumColorBits( 0 );
    pWindow_myWindow->setNumAccumAlphaBits( 0 );
    pWindow_myWindow->setNumMultiSampleBits( 0 );
    pWindow_myWindow->setSwapInterval( 1 );
    pWindow_myWindow->setPixelBufferMode( vrDrawContext::PIXEL_BUFFER_MODE_OFF );

    s_pInstancesToUnref->push_back( pWindow_myWindow );

    vpChannel* pChannel_myChannel = new vpChannel();
    pChannel_myChannel->setName( "myChannel" );
    pChannel_myChannel->setOffsetTranslate( 0.000000 ,  0.000000 ,  0.000000 );
    pChannel_myChannel->setOffsetRotate( 0.000000 ,  0.000000 ,  0.000000 );
    pChannel_myChannel->setCullMask( 0x0FFFFFFFF );
    pChannel_myChannel->setRenderMask( 0x0FFFFFFFF );
    pChannel_myChannel->setClearColor( 0.000000f ,  0.500000f ,  1.000000f ,  0.000000f );
    pChannel_myChannel->setClearBuffers( 0x03 );
    pChannel_myChannel->setDrawArea( 0.000000 ,  1.000000 ,  0.000000 ,  1.000000 );
    pChannel_myChannel->setFOVSymmetric( 45.000000f ,  -1.000000f );
    pChannel_myChannel->setNearFar( 1.000000f ,  35000.000000f );
    pChannel_myChannel->setLODVisibilityRangeScale( 1.000000 );
    pChannel_myChannel->setLODTransitionRangeScale( 1.000000 );
    pChannel_myChannel->setCullThreadPriority( vuThread::PRIORITY_NORMAL );
    pChannel_myChannel->setCullThreadProcessor( -1 );
    pChannel_myChannel->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_WIREFRAME ,  false );
    pChannel_myChannel->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_TRANSPARENCY ,  true );
    pChannel_myChannel->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_TEXTURE ,  true );
    pChannel_myChannel->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_LIGHT ,  true );
    pChannel_myChannel->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_FOG ,  true );
    pChannel_myChannel->setLightPointThreadPriority( vuThread::PRIORITY_NORMAL );
    pChannel_myChannel->setLightPointThreadProcessor( -1 );
    pChannel_myChannel->setMultiSample( vpChannel::MULTISAMPLE_OFF );
    pChannel_myChannel->setStatisticsPage( vpChannel::PAGE_OFF );
    pChannel_myChannel->setCullBoundingBoxTestEnable( false );
    pChannel_myChannel->setOpaqueSort( vpChannel::OPAQUE_SORT_TEXTURE ,  vpChannel::OPAQUE_SORT_MATERIAL );
    pChannel_myChannel->setTransparentSort( vpChannel::TRANSPARENT_SORT_DEPTH );
    pChannel_myChannel->setDrawBuffer( vpChannel::DRAW_BUFFER_DEFAULT );
    pChannel_myChannel->setStressEnable( false );
    pChannel_myChannel->setStressParameters( 1.000000f ,  20.000000f ,  0.750000f ,  0.500000f ,  2.000000f );

    s_pInstancesToUnref->push_back( pChannel_myChannel );

    vpChannel* pChannel_myChannelForPixelBuffer = new vpChannel();
    pChannel_myChannelForPixelBuffer->setName( "myChannelForPixelBuffer" );
    pChannel_myChannelForPixelBuffer->setOffsetTranslate( 0.000000 ,  0.000000 ,  0.000000 );
    pChannel_myChannelForPixelBuffer->setOffsetRotate( 0.000000 ,  0.000000 ,  0.000000 );
    pChannel_myChannelForPixelBuffer->setCullMask( 0x0FFFFFFFF );
    pChannel_myChannelForPixelBuffer->setRenderMask( 0x0FFFFFFFF );
    pChannel_myChannelForPixelBuffer->setClearColor( 0.933333f ,  0.807843f ,  0.513726f ,  0.000000f );
    pChannel_myChannelForPixelBuffer->setClearBuffers( 0x03 );
    pChannel_myChannelForPixelBuffer->setDrawArea( 0.000000 ,  1.000000 ,  0.000000 ,  1.000000 );
    pChannel_myChannelForPixelBuffer->setFOVSymmetric( 45.000000f ,  -1.000000f );
    pChannel_myChannelForPixelBuffer->setNearFar( 1.000000f ,  35000.000000f );
    pChannel_myChannelForPixelBuffer->setLODVisibilityRangeScale( 1.000000 );
    pChannel_myChannelForPixelBuffer->setLODTransitionRangeScale( 1.000000 );
    pChannel_myChannelForPixelBuffer->setCullThreadPriority( vuThread::PRIORITY_NORMAL );
    pChannel_myChannelForPixelBuffer->setCullThreadProcessor( -1 );
    pChannel_myChannelForPixelBuffer->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_WIREFRAME ,  false );
    pChannel_myChannelForPixelBuffer->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_TRANSPARENCY ,  true );
    pChannel_myChannelForPixelBuffer->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_TEXTURE ,  true );
    pChannel_myChannelForPixelBuffer->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_LIGHT ,  true );
    pChannel_myChannelForPixelBuffer->setGraphicsModeEnable( vpChannel::GRAPHICS_MODE_FOG ,  true );
    pChannel_myChannelForPixelBuffer->setLightPointThreadPriority( vuThread::PRIORITY_NORMAL );
    pChannel_myChannelForPixelBuffer->setLightPointThreadProcessor( -1 );
    pChannel_myChannelForPixelBuffer->setMultiSample( vpChannel::MULTISAMPLE_OFF );
    pChannel_myChannelForPixelBuffer->setStatisticsPage( vpChannel::PAGE_OFF );
    pChannel_myChannelForPixelBuffer->setCullBoundingBoxTestEnable( false );
    pChannel_myChannelForPixelBuffer->setOpaqueSort( vpChannel::OPAQUE_SORT_TEXTURE ,  vpChannel::OPAQUE_SORT_MATERIAL );
    pChannel_myChannelForPixelBuffer->setTransparentSort( vpChannel::TRANSPARENT_SORT_DEPTH );
    pChannel_myChannelForPixelBuffer->setDrawBuffer( vpChannel::DRAW_BUFFER_DEFAULT );
    pChannel_myChannelForPixelBuffer->setStressEnable( false );
    pChannel_myChannelForPixelBuffer->setStressParameters( 1.000000f ,  20.000000f ,  0.750000f ,  0.500000f ,  2.000000f );

    s_pInstancesToUnref->push_back( pChannel_myChannelForPixelBuffer );

    vpObserver* pObserver_myObserver = new vpObserver();
    pObserver_myObserver->setName( "myObserver" );
    pObserver_myObserver->setStrategyEnable( true );
    pObserver_myObserver->setTranslate( 2050.000000 ,  1074.000000 ,  4.500000 );
    pObserver_myObserver->setRotate( 57.900000 ,  358.000000 ,  0.000000 );
    pObserver_myObserver->setLatencyCriticalEnable( false );

    s_pInstancesToUnref->push_back( pObserver_myObserver );

    vpObserver* pObserver_myObserverForPixelBuffer = new vpObserver();
    pObserver_myObserverForPixelBuffer->setName( "myObserverForPixelBuffer" );
    pObserver_myObserverForPixelBuffer->setStrategyEnable( true );
    pObserver_myObserverForPixelBuffer->setTranslate( 0.000000 ,  0.000000 ,  0.000000 );
    pObserver_myObserverForPixelBuffer->setRotate( 0.000000 ,  0.000000 ,  0.000000 );
    pObserver_myObserverForPixelBuffer->setLatencyCriticalEnable( false );

    s_pInstancesToUnref->push_back( pObserver_myObserverForPixelBuffer );

    vpScene* pScene_myScene = new vpScene();
    pScene_myScene->setName( "myScene" );

    s_pInstancesToUnref->push_back( pScene_myScene );

    vpScene* pScene_mySceneForPixelBuffer = new vpScene();
    pScene_mySceneForPixelBuffer->setName( "mySceneForPixelBuffer" );
    pScene_mySceneForPixelBuffer->setCullMask( 0x0FFFFFFFF );
    pScene_mySceneForPixelBuffer->setRenderMask( 0x0FFFFFFFF );
    pScene_mySceneForPixelBuffer->setIsectMask( 0x0FFFFFFFF );

    s_pInstancesToUnref->push_back( pScene_mySceneForPixelBuffer );

    vpObject* pObject_hummer = new vpObject();
    pObject_hummer->setName( "hummer" );
    pObject_hummer->setCullMask( 0x0FFFFFFFF );
    pObject_hummer->setRenderMask( 0x0FFFFFFFF );
    pObject_hummer->setIsectMask( 0x0FFFFFFFF );
    pObject_hummer->setStrategyEnable( true );
    pObject_hummer->setTranslate( 0.000000 ,  0.000000 ,  0.000000 );
    pObject_hummer->setRotate( 0.000000 ,  0.000000 ,  0.000000 );
    pObject_hummer->setScale( 1.000000 ,  1.000000 ,  1.000000 );
    pObject_hummer->setStaticEnable( false );
    pObject_hummer->setFileName( "hmmwv.flt" );
    pObject_hummer->setAutoPage( vpObject::AUTO_PAGE_SYNCHRONOUS );
    pObject_hummer->setManualLODChild( -1 );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_COMBINE_LIGHT_POINTS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_COMBINE_LODS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_IGNORE_DOF_CONSTRAINTS ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_EXTERNAL_REF_FLAGS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_GENERIC_NAMES ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_GENERIC_NODES ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_QUADS ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_ALL_GEOMETRIES_LIT ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_USE_MATERIAL_DIFFUSE_COLOR ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_MONOCHROME ,  false );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_CREATE_ANIMATIONS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_CONTROLS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_ANIMATIONS ,  true );
    pObject_hummer->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_APPEARANCES ,  true );
    pObject_hummer->setLoaderDetailMultiTextureStage( -1 );
    pObject_hummer->setLoaderBlendTolerance( 0.050000f );
    pObject_hummer->setLoaderUnits( vsNodeLoader::Data::LOADER_UNITS_METERS );
    pObject_hummer->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_OPTIMIZE_GEOMETRIES ,  true );
    pObject_hummer->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_COLLAPSE_BINDINGS ,  true );
    pObject_hummer->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_COLLAPSE_TRIANGLE_STRIPS ,  true );
    pObject_hummer->setBuilderNormalMode( vsNodeLoader::Data::BUILDER_NORMAL_MODE_PRESERVE );
    pObject_hummer->setBuilderColorTolerance( 0.001000f );
    pObject_hummer->setBuilderNormalTolerance( 0.860000f );
    pObject_hummer->setBuilderVertexTolerance( 0.000100f );
    pObject_hummer->setGeometryOption( vsNodeLoader::Data::GEOMETRY_OPTION_GENERATE_DISPLAY_LISTS ,  false );
    pObject_hummer->setGeometryFormat( vrGeometryBase::FORMAT_VERTEX_ARRAY ,  0x0FFF );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_FLATTEN ,  true );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_CLEAN ,  true );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_MERGE_GEOMETRIES ,  true );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_COLLAPSE_BINDINGS ,  true );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_COLLAPSE_TRIANGLE_STRIPS ,  true );
    pObject_hummer->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_VALIDATE ,  true );
    pObject_hummer->setTextureSubloadEnable( false );
    pObject_hummer->setTextureSubloadRender( vpGeometry::TEXTURE_SUBLOAD_RENDER_DEFERRED );

    s_pInstancesToUnref->push_back( pObject_hummer );

    vpObject* pObject_town = new vpObject();
    pObject_town->setName( "town" );
    pObject_town->setCullMask( 0x0FFFFFFFF );
    pObject_town->setRenderMask( 0x0FFFFFFFF );
    pObject_town->setIsectMask( 0x0FFFFFFFF );
    pObject_town->setStrategyEnable( true );
    pObject_town->setTranslate( 0.000000 ,  0.000000 ,  0.000000 );
    pObject_town->setRotate( 0.000000 ,  0.000000 ,  0.000000 );
    pObject_town->setScale( 1.000000 ,  1.000000 ,  1.000000 );
    pObject_town->setStaticEnable( false );
    pObject_town->setFileName( "town.flt" );
    pObject_town->setAutoPage( vpObject::AUTO_PAGE_SYNCHRONOUS );
    pObject_town->setManualLODChild( -1 );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_COMBINE_LIGHT_POINTS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_COMBINE_LODS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_IGNORE_DOF_CONSTRAINTS ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_EXTERNAL_REF_FLAGS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_GENERIC_NAMES ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_GENERIC_NODES ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_PRESERVE_QUADS ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_ALL_GEOMETRIES_LIT ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_USE_MATERIAL_DIFFUSE_COLOR ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_MONOCHROME ,  false );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_CREATE_ANIMATIONS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_CONTROLS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_ANIMATIONS ,  true );
    pObject_town->setLoaderOption( vsNodeLoader::Data::LOADER_OPTION_SHARE_LIGHT_POINT_APPEARANCES ,  true );
    pObject_town->setLoaderDetailMultiTextureStage( -1 );
    pObject_town->setLoaderBlendTolerance( 0.050000f );
    pObject_town->setLoaderUnits( vsNodeLoader::Data::LOADER_UNITS_METERS );
    pObject_town->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_OPTIMIZE_GEOMETRIES ,  true );
    pObject_town->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_COLLAPSE_BINDINGS ,  true );
    pObject_town->setBuilderOption( vsNodeLoader::Data::BUILDER_OPTION_COLLAPSE_TRIANGLE_STRIPS ,  true );
    pObject_town->setBuilderNormalMode( vsNodeLoader::Data::BUILDER_NORMAL_MODE_PRESERVE );
    pObject_town->setBuilderColorTolerance( 0.001000f );
    pObject_town->setBuilderNormalTolerance( 0.860000f );
    pObject_town->setBuilderVertexTolerance( 0.000100f );
    pObject_town->setGeometryOption( vsNodeLoader::Data::GEOMETRY_OPTION_GENERATE_DISPLAY_LISTS ,  false );
    pObject_town->setGeometryFormat( vrGeometryBase::FORMAT_VERTEX_ARRAY ,  0x0FFF );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_FLATTEN ,  true );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_CLEAN ,  true );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_MERGE_GEOMETRIES ,  true );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_COLLAPSE_BINDINGS ,  true );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_COLLAPSE_TRIANGLE_STRIPS ,  true );
    pObject_town->setPostLoadOption( vpGeometryPageable::POST_LOAD_OPTION_VALIDATE ,  true );
    pObject_town->setTextureSubloadEnable( false );
    pObject_town->setTextureSubloadRender( vpGeometry::TEXTURE_SUBLOAD_RENDER_DEFERRED );

    s_pInstancesToUnref->push_back( pObject_town );

    vpRecyclingService* pRecyclingService_myRecyclingService = vpRecyclingService::instance();
    pRecyclingService_myRecyclingService->setMultiThread( vpRecyclingService::MULTITHREAD_INLINE );
    pRecyclingService_myRecyclingService->setThreadPriority( vuThread::PRIORITY_NORMAL );
    pRecyclingService_myRecyclingService->setThreadProcessor( -1 );
    pRecyclingService_myRecyclingService->setRecycleTime( -1.000000 );

    vpEnv* pEnv_myEnv = new vpEnv();
    pEnv_myEnv->setName( "myEnv" );
    pEnv_myEnv->setDate( 22 ,  6 ,  2002 );
    pEnv_myEnv->setTimeOfDay( 12.000000f );
    pEnv_myEnv->setTimeMultiplier( 1.000000f );
    pEnv_myEnv->setEphemerisUpdateInterval( 0.000000f );
    pEnv_myEnv->setReferencePosition( -96.790001f ,  32.790001f );
    pEnv_myEnv->setEphemerisTimeZoneOffset( -10000 );
    pEnv_myEnv->setSkyColor( 0.513725f ,  0.701961f ,  0.941176f ,  1.000000f );
    pEnv_myEnv->setVisibilityType( vpEnvFx::VISIBILITY_TYPE_PIXEL_EXP2 );
    pEnv_myEnv->setVisibilityRangeOnset( 0.000000f );
    pEnv_myEnv->setVisibilityRangeOpaque( 80000.000000f );
    pEnv_myEnv->setVisibilityColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnv_myEnv->setLocalViewerEnable( false );
    pEnv_myEnv->setTwoSidedLightingEnable( false );
    pEnv_myEnv->setAmbientLightingColor( 0.000000f ,  0.000000f ,  0.000000f ,  1.000000f );
    pEnv_myEnv->setLightColorScale( vpEnv::COLOR_AMBIENT ,  1.000000f );
    pEnv_myEnv->setLightColorScale( vpEnv::COLOR_DIFFUSE ,  1.000000f );
    pEnv_myEnv->setLightColorScale( vpEnv::COLOR_SPECULAR ,  1.000000f );
    pEnv_myEnv->setDominantCelestialLightingEnable( false );

    s_pInstancesToUnref->push_back( pEnv_myEnv );

    vpEnv* pEnv_myPixelBufferEnv = new vpEnv();
    pEnv_myPixelBufferEnv->setName( "myPixelBufferEnv" );
    pEnv_myPixelBufferEnv->setDate( 22 ,  6 ,  2002 );
    pEnv_myPixelBufferEnv->setTimeOfDay( 6.000000f );
    pEnv_myPixelBufferEnv->setTimeMultiplier( 1.000000f );
    pEnv_myPixelBufferEnv->setEphemerisUpdateInterval( 0.000000f );
    pEnv_myPixelBufferEnv->setReferencePosition( -96.790001f ,  32.790001f );
    pEnv_myPixelBufferEnv->setEphemerisTimeZoneOffset( -10000 );
    pEnv_myPixelBufferEnv->setSkyColor( 0.513725f ,  0.701961f ,  0.941176f ,  1.000000f );
    pEnv_myPixelBufferEnv->setVisibilityType( vpEnvFx::VISIBILITY_TYPE_PIXEL_EXP2 );
    pEnv_myPixelBufferEnv->setVisibilityRangeOnset( 0.000000f );
    pEnv_myPixelBufferEnv->setVisibilityRangeOpaque( 80000.000000f );
    pEnv_myPixelBufferEnv->setVisibilityColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnv_myPixelBufferEnv->setLocalViewerEnable( false );
    pEnv_myPixelBufferEnv->setTwoSidedLightingEnable( false );
    pEnv_myPixelBufferEnv->setAmbientLightingColor( 0.000000f ,  0.000000f ,  0.000000f ,  1.000000f );
    pEnv_myPixelBufferEnv->setLightColorScale( vpEnv::COLOR_AMBIENT ,  1.000000f );
    pEnv_myPixelBufferEnv->setLightColorScale( vpEnv::COLOR_DIFFUSE ,  1.000000f );
    pEnv_myPixelBufferEnv->setLightColorScale( vpEnv::COLOR_SPECULAR ,  1.000000f );
    pEnv_myPixelBufferEnv->setDominantCelestialLightingEnable( false );

    s_pInstancesToUnref->push_back( pEnv_myPixelBufferEnv );

    vpEnvSun* pEnvSun_myEnvSun = new vpEnvSun();
    pEnvSun_myEnvSun->setName( "myEnvSun" );
    pEnvSun_myEnvSun->setEnable( true );
    pEnvSun_myEnvSun->setTwilightDip( -18.000000f );
    pEnvSun_myEnvSun->setGeometryEnable( true );
    pEnvSun_myEnvSun->setTextureFile( "sun.inta" );
    pEnvSun_myEnvSun->setTextureBlendColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnvSun_myEnvSun->setTextureBlendMode( vpEnvSun::TEXTURE_BLEND_MODE_MODULATE );
    pEnvSun_myEnvSun->setColor( 0.992156f ,  1.000000f ,  0.949019f ,  1.000000f );
    pEnvSun_myEnvSun->setVisibilityRange( 8000.000000f );
    pEnvSun_myEnvSun->setAngularSize( 5.500000f );
    pEnvSun_myEnvSun->setHorizonAngle( 40.000000f );
    pEnvSun_myEnvSun->setHorizonColor( 1.000000f ,  0.545098f ,  0.239216f ,  1.000000f );
    pEnvSun_myEnvSun->setHorizonSizeScale( 2.000000f );
    pEnvSun_myEnvSun->setHorizonLightColorScale( 0.250000f );

    s_pInstancesToUnref->push_back( pEnvSun_myEnvSun );

    vpEnvSun* pEnvSun_myPixelBufferEnvSun = new vpEnvSun();
    pEnvSun_myPixelBufferEnvSun->setName( "myPixelBufferEnvSun" );
    pEnvSun_myPixelBufferEnvSun->setEnable( true );
    pEnvSun_myPixelBufferEnvSun->setTwilightDip( -18.000000f );
    pEnvSun_myPixelBufferEnvSun->setGeometryEnable( false );
    pEnvSun_myPixelBufferEnvSun->setTextureFile( "sun.inta" );
    pEnvSun_myPixelBufferEnvSun->setTextureBlendColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnvSun_myPixelBufferEnvSun->setTextureBlendMode( vpEnvSun::TEXTURE_BLEND_MODE_MODULATE );
    pEnvSun_myPixelBufferEnvSun->setColor( 0.992156f ,  1.000000f ,  0.949019f ,  1.000000f );
    pEnvSun_myPixelBufferEnvSun->setVisibilityRange( 8000.000000f );
    pEnvSun_myPixelBufferEnvSun->setAngularSize( 5.500000f );
    pEnvSun_myPixelBufferEnvSun->setHorizonAngle( 40.000000f );
    pEnvSun_myPixelBufferEnvSun->setHorizonColor( 1.000000f ,  0.545098f ,  0.239216f ,  1.000000f );
    pEnvSun_myPixelBufferEnvSun->setHorizonSizeScale( 2.000000f );
    pEnvSun_myPixelBufferEnvSun->setHorizonLightColorScale( 0.250000f );

    s_pInstancesToUnref->push_back( pEnvSun_myPixelBufferEnvSun );

    vpEnvMoon* pEnvMoon_myEnvMoon = new vpEnvMoon();
    pEnvMoon_myEnvMoon->setName( "myEnvMoon" );
    pEnvMoon_myEnvMoon->setEnable( true );
    pEnvMoon_myEnvMoon->setBrightness( 0.250000f );
    pEnvMoon_myEnvMoon->setGeometryEnable( true );
    pEnvMoon_myEnvMoon->setTextureFile( "moon.inta" );
    pEnvMoon_myEnvMoon->setTextureBlendColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnvMoon_myEnvMoon->setTextureBlendMode( vpEnvMoon::TEXTURE_BLEND_MODE_MODULATE );
    pEnvMoon_myEnvMoon->setColor( 0.811765f ,  0.886275f ,  0.937255f ,  1.000000f );
    pEnvMoon_myEnvMoon->setVisibilityRange( 15000.000000f );
    pEnvMoon_myEnvMoon->setAngularSize( 1.500000f );
    pEnvMoon_myEnvMoon->setHorizonAngle( 30.000000f );
    pEnvMoon_myEnvMoon->setHorizonColor( 0.811765f ,  0.886275f ,  0.937255f ,  1.000000f );
    pEnvMoon_myEnvMoon->setHorizonSizeScale( 1.700000f );
    pEnvMoon_myEnvMoon->setHorizonLightColorScale( 0.000000f );

    s_pInstancesToUnref->push_back( pEnvMoon_myEnvMoon );

    vpEnvSkyDome* pEnvSkyDome_myEnvSkyDome = new vpEnvSkyDome();
    pEnvSkyDome_myEnvSkyDome->setName( "myEnvSkyDome" );
    pEnvSkyDome_myEnvSkyDome->setEnable( true );
    pEnvSkyDome_myEnvSkyDome->setGroundColor( 0.211765f ,  0.286275f ,  0.149020f ,  1.000000f );
    pEnvSkyDome_myEnvSkyDome->setGroundEnable( true );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 0 ,  3500.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 1 ,  10500.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 2 ,  26250.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 3 ,  31500.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 4 ,  35000.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 5 ,  35000.000000f );
    pEnvSkyDome_myEnvSkyDome->setVisibilityRange( 6 ,  35000.000000f );

    s_pInstancesToUnref->push_back( pEnvSkyDome_myEnvSkyDome );

    vpEnvCloudLayer* pEnvCloudLayer_myEnvCloudLayer = new vpEnvCloudLayer();
    pEnvCloudLayer_myEnvCloudLayer->setName( "myEnvCloudLayer" );
    pEnvCloudLayer_myEnvCloudLayer->setEnable( true );
    pEnvCloudLayer_myEnvCloudLayer->setColor( 0.956863f ,  0.976471f ,  0.984314f ,  1.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setElevation( 3000.000000f ,  5000.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setTransitionRange( 500.000000f ,  500.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setScudEnable( false );
    pEnvCloudLayer_myEnvCloudLayer->setTextureFile( "cloud_scattered.inta" );
    pEnvCloudLayer_myEnvCloudLayer->setTextureBlendColor( 1.000000f ,  1.000000f ,  1.000000f ,  1.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setTextureBlendMode( vpEnvCloudLayer::TEXTURE_BLEND_MODE_MODULATE );
    pEnvCloudLayer_myEnvCloudLayer->setTextureTiling( 3.000000f ,  3.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setMinVisibilityScale( 0.000000f );
    pEnvCloudLayer_myEnvCloudLayer->setHorizonColorScale( 1.000000f );

    s_pInstancesToUnref->push_back( pEnvCloudLayer_myEnvCloudLayer );

    vpEnvWind* pEnvWind_myEnvWind = new vpEnvWind();
    pEnvWind_myEnvWind->setName( "myEnvWind" );
    pEnvWind_myEnvWind->setEnable( true );
    pEnvWind_myEnvWind->setSpeed( 0.000000f );
    pEnvWind_myEnvWind->setDirection( 0.000000f ,  1.000000f ,  0.000000f );

    s_pInstancesToUnref->push_back( pEnvWind_myEnvWind );

    vpMotionGame* pMotionGame_myMotionGame = new vpMotionGame();
    pMotionGame_myMotionGame->setName( "myMotionGame" );
    pMotionGame_myMotionGame->setSpeed( 1.000000 );
    pMotionGame_myMotionGame->setSpeedDelta( 1.000000 );
    pMotionGame_myMotionGame->setRateLook( 50.000000 );

    s_pInstancesToUnref->push_back( pMotionGame_myMotionGame );

    vpMotionUFO* pMotionUFO_myMotion = new vpMotionUFO();
    pMotionUFO_myMotion->setName( "myMotion" );
    pMotionUFO_myMotion->setSpeed( 100.000000 );
    pMotionUFO_myMotion->setBoost( 50.000000 );
    pMotionUFO_myMotion->setBoostTurning( 5.000000 );
    pMotionUFO_myMotion->setRateHeading( 40.000000 );
    pMotionUFO_myMotion->setRatePitch( 20.000000 );

    s_pInstancesToUnref->push_back( pMotionUFO_myMotion );

    vpMotionTetherSpin* pMotionTetherSpin_myMotionTetherSpin = new vpMotionTetherSpin();
    pMotionTetherSpin_myMotionTetherSpin->setName( "myMotionTetherSpin" );
    pMotionTetherSpin_myMotionTetherSpin->setENUBasedEnable( false );
    pMotionTetherSpin_myMotionTetherSpin->setResponseScale( 8 );
    pMotionTetherSpin_myMotionTetherSpin->setInputEnable( false );
    pMotionTetherSpin_myMotionTetherSpin->setRadius( 7.000000 );
    pMotionTetherSpin_myMotionTetherSpin->setAngularRate( 0.500000 );
    pMotionTetherSpin_myMotionTetherSpin->setElevation( 2.000000 );

    s_pInstancesToUnref->push_back( pMotionTetherSpin_myMotionTetherSpin );



    //
    // Satisfy all references
    //



    pPipeline_myPipeline->addWindow( pWindow_myWindow );
    pPipeline_myPipeline->addWindow( pWindow_myPixelBuffer );

    pWindow_myPixelBuffer->addChannel( pChannel_myChannelForPixelBuffer );

    pWindow_myWindow->addChannel( pChannel_myChannel );



    pObserver_myObserver->setStrategy( pMotionGame_myMotionGame );
    pObserver_myObserver->addChannel( pChannel_myChannel );
    pObserver_myObserver->addAttachment( pEnv_myEnv );
    pObserver_myObserver->setScene( pScene_myScene );

    pObserver_myObserverForPixelBuffer->setStrategy( pMotionTetherSpin_myMotionTetherSpin );
    pObserver_myObserverForPixelBuffer->addChannel( pChannel_myChannelForPixelBuffer );
    pObserver_myObserverForPixelBuffer->addAttachment( pEnv_myPixelBufferEnv );
    pObserver_myObserverForPixelBuffer->setScene( pScene_mySceneForPixelBuffer );

    pScene_myScene->addChild( pObject_town );

    pScene_mySceneForPixelBuffer->addChild( pObject_hummer );




    pEnv_myEnv->addEnvFx( pEnvSun_myEnvSun );
    pEnv_myEnv->addEnvFx( pEnvMoon_myEnvMoon );
    pEnv_myEnv->addEnvFx( pEnvSkyDome_myEnvSkyDome );
    pEnv_myEnv->addEnvFx( pEnvCloudLayer_myEnvCloudLayer );
    pEnv_myEnv->addEnvFx( pEnvWind_myEnvWind );

    pEnv_myPixelBufferEnv->addEnvFx( pEnvSun_myPixelBufferEnvSun );









    pMotionTetherSpin_myMotionTetherSpin->setTetherReference( pObject_hummer );

}




void unconfigure( void )
{
    //
    // Unref all created instances
    //

    s_pInstancesToUnref->clear();
    delete s_pInstancesToUnref;
}





//
// Main Program
//

void main(int argc, char *argv[])
{
    // initialize Vega Prime
    vp::initialize(argc, argv);

    // create my app instance
    vpApp *app = new vpApp;

    // use the code generated by LynX Prime
    define();

    // configure my app instance
    app->configure();

    // execute the main runtime loop
    app->run();

    // call the unconfig code generated by LynX Prime
    unconfigure();

    // delete my app instance
    app->unref();

    // shutdown Vega Prime
    vp::shutdown();

}
jgy86324 评论于2010-4-13 19:02:51
虽然加入这两个代码都可以让其运行起来,但为什么会对同一个ACF得出的代码不同呢,这是不懂的地方,谢谢你的耐心解释哈
sichuanwww 评论于2010-4-13 21:16:42
if (argc <= 1)
        app->define("vp_pixel_buffer.acf");
    else app->define(argv[1]);
这里使用了ACF文件,就相当于导出文件里面的define函数
本质上,7楼是纯粹的CPP代码,没有使用ACF文件,而6楼使用了ACF文件。
努力挣钱,快乐生活!
jgy86324 评论于2010-4-13 21:49:41
换句话说就是,如果能够在LP中实现,形成.acf文件,那.cpp直接用以下代码就可以了,不用在编程了,对吧?
int main(int argc, char *argv[])
{
    // initialize vega prime
    vp::initialize(argc, argv);

    // create my app instance
    myApp *app = new myApp;

    // load the acf file
    if (argc <= 1)
        app->define("vp_pixel_buffer.acf");
    else app->define(argv[1]);

    // configure my app
    app->configure();

    // execute the main runtime loop
    app->run();

    // delete my app instance
    app->unref();

    // shutdown vega prime
    vp::shutdown();

    return 0;
}
编程只是为了在现有框架下实现在LP中实现不了东西,我这个说法对吗?
sichuanwww 评论于2010-4-14 08:03:53
可以这么说。完全看项目需求和开发者的习惯。
但很多时候,必须采用编程的方式来控制才能实现要求。
努力挣钱,快乐生活!
jgy86324 评论于2010-4-14 09:49:52
谢谢了哈。。。
hejinzheng 评论于2010-8-12 18:50:21
LP的源代码怎么在VS2003中生成的啊,还有如果改变了源代码是不是就能改变运动状态啊
jgy86324 评论于2010-8-17 10:52:53
LP的源代码怎么在VS2003中生成的啊,还有如果改变了源代码是不是就能改变运动状态啊 ...
hejinzheng 发表于 2010-8-12 06:50 PM



    在LP中有生成C++源代码这一选项,LP只是能够配置基本的运动状态,复杂的运动状态需要添加代码俩实现
hejinzheng 评论于2010-8-17 20:25:11
谢谢啦,现在明白了,就是代码有点麻烦,都是类

手机版|VR开发网 ( 津ICP备18009691号 ) 统计 网安备12019202000257

GMT+8, 2020-9-30 10:47 PM

返回顶部