<< Lightflow C++-Tutorial for beginners 戻る Lightflow C API sample ball3 >>

Lightflow C API sample ball2

2018/10/22
sample ball2
main2.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 << "basis" << "sin";
list << "scale" << 0.6;
list << "depth" << 0.2;
list << "turbulence.omega" << 0.5 << 0.7;
list << "turbulence.octaves" << LfInt( 6 );
LfInt bump = s->NewPattern( "multifractal", list );

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


s->MaterialBegin( plastic );

list.Reset();
list << "radius" << 1.0;
LfInt sphere = s->NewObject( "sphere", list );

list.Reset();
list << "surfaces" << sphere;
list << "tolerance" << 0.02 << 0.1 << 0.05;
s->AddObject( s->NewObject( "surface-engine", list ) );

s->MaterialEnd();


list.Reset();
list << "file" << "ball2.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 main2.cpp -o simplescene2
$ ./simplescene2
$ convert ball2.tga ball2.jpg
$ eog ball2.jpg
ball2.jpg
main22.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 << "basis" << "sin";
list << "scale" << 0.6;
list << "depth" << 0.2;
list << "turbulence.omega" << 0.5 << 0.7;
list << "turbulence.octaves" << LfInt( 6 );
LfInt bump = s->NewPattern( "multifractal", list );

list.Reset();
list << "kr" << LfVector3(0.3,0.3,0.5);
list << "kd" << 0.3;
list << "km" << 0.3;
list << "shinyness" << 0.8;
list << "fresnel" << LfInt(1) << LfFloat(0.5) << LfFloat(0.5);
list << "caustics" << LfInt(1) << LfInt(1);
list << "displacement" << bump;
LfInt bumpmetal = s->NewMaterial( "physical", list );

s->MaterialBegin( bumpmetal );

list.Reset();
list << "radius" << 1.0;
LfInt sphere = s->NewObject( "sphere", list );

list.Reset();
list << "surfaces" << sphere;
list << "tolerance" << 0.02 << 0.1 << 0.05;
s->AddObject( s->NewObject( "surface-engine", list ) );

s->MaterialEnd();

list.Reset();
list << "file" << "ball2.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 main22.cpp -o simplescene22
$ ./simplescene22
$ convert ball2.tga ball2.jpg
$ eog ball2.jpg
ball2.jpg
  • -
  • -

<< Lightflow C++-Tutorial for beginners 戻る Lightflow C API sample ball3 >>