Rendering学習日記

日々3DCGの世界は進歩しているけど、勉強して理解したことをまとめていきたい。RenderMan互換レンダラーやグローバル・イルミネーション。いろんなことに好奇心を持ち面白くなってくる。目指せShader書き!!

<< Lightflow C API sample ball2 | main | Lightflow C API sample lights >>

Lightflow C API sample ball3

main3.cpp
#includeの両側に半角スペースが入っています。


#include < Lightflow/LfLocalSceneProxy.h >

int main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;

list.Reset();
list << "position" << LfPoint( 5.0, -5.0, 4.0 );
list << "color" << LfColor( 300.0, 300.0, 300.0 );
s->LightOn( s->NewLight( "point", list ) );


list.Reset();
list << "kr" << LfColor( 1.0, 0.9, 0.8 );
list << "kaf" << 0.3;
list << "density" << 0.3;
list << "sampling" << 40.0;
list << "shadow-caching" << LfPoint( -1.2, -1.2, -1.2 ) << LfPoint(
1.2, 1.2, 1.2 );
LfInt gas = s->NewInterior( "dust", list );

s->InteriorBegin( gas );

list.Reset();
LfInt cloud = s->NewMaterial( "transparent", list );

s->InteriorEnd();


s->MaterialBegin( cloud );

list.Reset();
list << "radius" << 1.2;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


list.Reset();
list << "ka" << LfColor( 0, 0, 0.5 );
list << "kc" << LfColor( 1, 0.5, 0.5 );
list << "kd" << 0.5;
list << "km" << 0.1;
LfInt plastic = s->NewMaterial( "standard", list );

s->MaterialBegin( plastic );

list.Reset();
list << "radius" << 0.5;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


list.Reset();
list << "file" << "ball3.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );

delete s;
}


$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main3.cpp -o simplescene3
$ ./simplescene3
$ convert ball3.tga ball3.jpg
$ eog ball3.jpg
ball3.jpg
Lightflow | - | -