<s> from direct . showbase . ShowBase import ShowBase <EOL> import direct . directbase . DirectStart <EOL> from pandac . PandaModules import * <EOL> from terrain . bakery . bakery import Tile , parseFile , loadTex <EOL> import math <EOL> """<STR_LIT>""" <EOL> class RenderNode ( NodePath ) : <EOL> def __init__ ( self , path , terrainNode , heightScale ) : <EOL> NodePath . __init__ ( self , path + "<STR_LIT>" ) <EOL> self . heightScale = heightScale <EOL> d = parseFile ( path + '<STR_LIT>' ) <EOL> def getRenderMapType ( name ) : <EOL> return getattr ( TextureStage , name ) <EOL> def getCombineMode ( name ) : <EOL> return getattr ( TextureStage , name ) <EOL> self . mapTexStages = { } <EOL> self . specialMaps = { } <EOL> for m in d [ '<STR_LIT>' ] : <EOL> s = m . split ( '<STR_LIT:\t>' ) <EOL> self . specialMaps [ s [ <NUM_LIT:1> ] ] = s [ <NUM_LIT:0> ] <EOL> self . terrainNode = terrainNode <EOL> self . terrainNode . reparentTo ( self ) <EOL> self . texList = [ ] <EOL> if "<STR_LIT>" in d : <EOL> sort = <NUM_LIT:0> ; <EOL> for m in d [ "<STR_LIT>" ] : <EOL> sort += <NUM_LIT:1> <EOL> s = m . split ( ) <EOL> name = s [ <NUM_LIT:0> ] <EOL> texStage = TextureStage ( name + '<STR_LIT>' + str ( sort ) ) <EOL> texStage . setSort ( sort ) <EOL> source = s [ <NUM_LIT:1> ] <EOL> def setTexModes ( modeText ) : <EOL> combineMode = [ ] <EOL> for t in modeText : <EOL> if t [ : <NUM_LIT:1> ] == '<STR_LIT:M>' : <EOL> texStage . setMode ( getRenderMapType ( t ) ) <EOL> elif t [ : <NUM_LIT:1> ] == '<STR_LIT:C>' : <EOL> combineMode . append ( getCombineMode ( t ) ) <EOL> elif t == '<STR_LIT>' : <EOL> texStage . setSavedResult ( True ) <EOL> else : <EOL> print "<STR_LIT>" + name <EOL> if len ( combineMode ) > <NUM_LIT:0> : <EOL> texStage . setCombineRgb ( * combineMode ) <EOL> if len ( modeText ) == <NUM_LIT:0> : <EOL> texStage . setMode ( TextureStage . MModulate ) <EOL> if source == '<STR_LIT:file>' : <EOL> setTexModes ( s [ <NUM_LIT:3> : ] ) <EOL> tex = loadTex ( path + "<STR_LIT>" + name ) <EOL> self . terrainNode . setTexture ( texStage , tex ) <EOL> self . terrainNode . setShaderInput ( '<STR_LIT>' + name , tex ) <EOL> self . texList . append ( ( texStage , float ( s [ <NUM_LIT:2> ] ) ) ) <EOL> elif source == '<STR_LIT>' : <EOL> setTexModes ( s [ <NUM_LIT:2> : ] ) <EOL> self . mapTexStages [ s [ <NUM_LIT:0> ] ] = texStage <EOL> else : <EOL> print '<STR_LIT>' + name + '<STR_LIT>' </s>
