Skip to content

Commit

Permalink
#2 : Offset BK, BG colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ABelliqueux committed Jul 3, 2021
1 parent f5ae70b commit 7e0b246
Showing 1 changed file with 11 additions and 33 deletions.
44 changes: 11 additions & 33 deletions io_export_psx_tmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ def linearToRGB(component):
"\tMATRIX mat;\n" +
"\tVECTOR pos;\n" +
"\tSVECTOR rot;\n" +
"\tshort isProp;\n" +
"\tshort isRigidBody;\n" +
"\tshort isStaticBody;\n" +
"\tshort isRound;\n" +
Expand Down Expand Up @@ -1050,19 +1051,19 @@ def linearToRGB(component):
## Horizon & Ambient color

# Get world horizon colors
BGr = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.r ) * 255 ) )
BGg = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.g ) * 255) )
BGb = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.b ) * 255 ) )
BGr = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.r ) * 192 ) + 64 )
BGg = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.g ) * 192) + 64 )
BGb = str( round( linearToRGB( bpy.data.worlds[0].horizon_color.b ) * 192 ) + 64 )

f.write(
"CVECTOR " + fileName + "_BGc = { " + BGr + ", " + BGg + ", " + BGb + ", 0 };\n\n"
)
level_symbols.append( "CVECTOR " + fileName + "_BGc" )

# Get ambient color
BKr = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.r ) * 255 ) )
BKg = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.g ) * 255) )
BKb = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.b ) * 255 ) )
BKr = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.r ) * 192 ) + 64 )
BKg = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.g ) * 192 ) + 64 )
BKb = str( round( linearToRGB( bpy.data.worlds[0].ambient_color.b ) * 192 ) + 64 )

f.write(
"VECTOR " + fileName + "_BKc = { " + BKr + ", " + BKg + ", " + BKb + ", 0 };\n\n"
Expand Down Expand Up @@ -1532,6 +1533,8 @@ def linearToRGB(component):

'isAnim':0,

'isProp':0,

'isRigidBody':0,

'isStaticBody':0,
Expand Down Expand Up @@ -1680,33 +1683,6 @@ def linearToRGB(component):
# Write object matrix, rot and pos vectors

f.write(

# ~ "MATRIX " + fileName + "_model"+cleanName+"_matrix = {0};\n" +

# ~ "VECTOR " + fileName + "_model"+cleanName+"_pos = {"+ str(round(bpy.data.objects[m.name].location.x * scale)) + "," + str(round(-bpy.data.objects[m.name].location.z * scale)) + "," + str(round(bpy.data.objects[m.name].location.y * scale)) + ", 0};\n" +

# ~ "SVECTOR " + fileName + "_model"+cleanName+"_rot = {"+ str(round(degrees(bpy.data.objects[m.name].rotation_euler.x)/360 * 4096)) + "," + str(round(degrees(-bpy.data.objects[m.name].rotation_euler.z)/360 * 4096)) + "," + str(round(degrees(bpy.data.objects[m.name].rotation_euler.y)/360 * 4096)) + "};\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isRigidBody = " + str(int(chkProp['isRigidBody'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isStaticBody = " + str(int(chkProp['isStaticBody'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isPrism = " + str(int(chkProp['isPrism'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isAnim = " + str(int(chkProp['isAnim'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isActor = " + str(int(chkProp['isActor'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isLevel = " + str(int(chkProp['isLevel'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isBG = " + str(int(chkProp['isBG'])) + ";\n" +

# ~ "short " + fileName + "_model"+cleanName+"_isSprite = " + str(int(chkProp['isSprite'])) + ";\n" +

# ~ "long " + fileName + "_model"+cleanName+"_p = 0;\n" +

# ~ "long " + fileName + "_model"+cleanName+"_OTz = 0;\n" +

"BODY " + fileName + "_model"+cleanName+"_body = {\n" +

"\t{0, 0, 0, 0},\n" +
Expand Down Expand Up @@ -1909,6 +1885,8 @@ def linearToRGB(component):

+ str(round(degrees(bpy.data.objects[m.name].rotation_euler.y)/360 * 4096)) + ", 0},\n" +

"\t" + str( int( chkProp[ 'isProp' ] ) ) + ", // isProp\n" +

"\t" + str( int( chkProp[ 'isRigidBody' ] ) ) + ", // isRigidBody\n" +

"\t" + str(int(chkProp['isStaticBody'])) + ", // isStaticBody\n" +
Expand Down

0 comments on commit 7e0b246

Please sign in to comment.