チェックは1色だけ変更できました。
#! /usr/bin/env python
from lightflowPM import *
from math import *
s = scene()
s.lightOn( s.newLight( "point", [ "position", vector3( 5.0, -5.0, 4.0 ), "color", vector3( 300.0, 300.0, 300.0 ) ] ) )
s.lightOn( s.newLight( "ambient", [ "color", vector3( 0.3, 0.3, 0.3 ) ] ) ) #環境光を加える。
plastic = s.newMaterial( "standard",[ "kc", vector3( 1, 0, 0 ) ] ) #赤
plastic2 = s.newMaterial( "standard",[ "kc", vector3( 0, 1, 0 ) ] ) #緑
plastic3 = s.newMaterial( "standard",[ "kc", vector3( 0, 0, 1 ) ] ) #青
check_ground=s.newPattern("check",["color",vector3( 0.2, 0.4, 0.6 ),"scale",0.025])
ground=s.newMaterial( "standard",[ "kc", check_ground,"kc",vector3( 1.0, 1.0, 1.0 ),"ka",check_ground ] ) #チェック青と白
#赤box
s.materialBegin( plastic )
s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )
s.materialEnd()
#緑box
s.materialBegin( plastic2 )
s.transformBegin( transform().translation( vector3(-3.0,0,0)))
s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )
s.transformEnd()
s.materialEnd()
#青box z軸中心に45度回転
s.materialBegin( plastic3 )
s.transformBegin( transform().translation( vector3(3.0,0,0)))
s.transformBegin( transform().rotationAroundZ( pi*45.0/180 ))
s.addObject( s.newObject( "box", [ "position",vector3( -1.0, -1.0, -1.0 ),vector3( 1.0, 1.0, 1.0 )] ) )
s.transformEnd()
s.transformEnd()
s.materialEnd()
#check模様の地面groundをpatchで作成しています。高さ(z軸)を-1.0にしてぴったり立方体とあわせています。
s.materialBegin( ground )
s.addObject( s.newObject( "patch", [ "points",vector3( -50, -50, -1.0 ),vector3( -50, 50, -1.0 ),vector3( 50, -50, -1.0 ),vector3( 50, 50, -1.0 )] ) )
s.materialEnd()
saver = s.newImager( "tga-saver", [ "file", "box_check.tga" ] )
s.imagerBegin( saver )
camera = s.newCamera( "pinhole", [ "eye", vector3( 0, -10, 5 ), "aim", vector3( 0, 0, 0 ) ] )
s.imagerEnd()
s.render( camera, 300, 300 )
- -
- -