unitary portal padding
This commit is contained in:
parent
7ed9802886
commit
0f4ccadaa4
@ -1464,6 +1464,58 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
visibleTarget.append( bpy.data.objects[ actorPtr ] )
|
visibleTarget.append( bpy.data.objects[ actorPtr ] )
|
||||||
|
|
||||||
|
# If visiblePortal length is under 2, this means there's only one portal
|
||||||
|
|
||||||
|
# Empty strings to be populated depending on portal position (left/right of screen)
|
||||||
|
|
||||||
|
before = ''
|
||||||
|
|
||||||
|
after = ''
|
||||||
|
|
||||||
|
if len( visiblePortal ) < 2 :
|
||||||
|
|
||||||
|
# Find wich side of screen the portal is on. left side : portal == bw, right side : portal == fw
|
||||||
|
|
||||||
|
screenCenterX = int( scene.render.resolution_x / 2 )
|
||||||
|
|
||||||
|
screenY = int( scene.render.resolution_y )
|
||||||
|
|
||||||
|
# Get vertices screen coordinates
|
||||||
|
|
||||||
|
s = objVertWtoS(scene, camera, visiblePortal[0])
|
||||||
|
|
||||||
|
# Check line
|
||||||
|
|
||||||
|
side = checkLine(
|
||||||
|
screenCenterX, 0, screenCenterX, screenY,
|
||||||
|
|
||||||
|
s[1].x,
|
||||||
|
|
||||||
|
s[1].y,
|
||||||
|
|
||||||
|
s[3].x,
|
||||||
|
|
||||||
|
s[3].y
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# If front == right of screen : fw
|
||||||
|
|
||||||
|
if side == "front":
|
||||||
|
|
||||||
|
# ~ print(str(visiblePortal[0]) + ' : fw')
|
||||||
|
|
||||||
|
before = "\t{\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 }\n\t},\n"
|
||||||
|
|
||||||
|
# If back == left of screen : bw
|
||||||
|
|
||||||
|
else :
|
||||||
|
|
||||||
|
# ~ print(str(visiblePortal[0]) + " : bw")
|
||||||
|
|
||||||
|
after = "\t{\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 }\n\t},\n"
|
||||||
|
|
||||||
|
|
||||||
prefix = CleanName(camera.name)
|
prefix = CleanName(camera.name)
|
||||||
|
|
||||||
# Include Tim data
|
# Include Tim data
|
||||||
@ -1490,17 +1542,13 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
"\t// Write quad NW, NE, SE, SW\n")
|
"\t// Write quad NW, NE, SE, SW\n")
|
||||||
|
|
||||||
# If visiblePoratl length is under 2, this means there's only one portal, hence a fw portal
|
f.write( before )
|
||||||
|
|
||||||
if len( visiblePortal ) < 2 :
|
|
||||||
|
|
||||||
f.write("\t{\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 },\n\t\t{ 0, 0, 0, 0 }\n\t},\n")
|
|
||||||
|
|
||||||
for portal in visiblePortal:
|
for portal in visiblePortal:
|
||||||
|
|
||||||
w = objVertLtoW(portal)
|
w = objVertLtoW(portal)
|
||||||
|
|
||||||
f.write("// " + str(portal) + "\n" )
|
# ~ f.write("\t// " + str(portal) + "\n" )
|
||||||
|
|
||||||
# Write portal'vertices world coordinates NW, NE, SE, SW
|
# Write portal'vertices world coordinates NW, NE, SE, SW
|
||||||
|
|
||||||
@ -1516,6 +1564,8 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
"\t},\n" )
|
"\t},\n" )
|
||||||
|
|
||||||
|
f.write( after )
|
||||||
|
|
||||||
# UNUSED : Screen coords
|
# UNUSED : Screen coords
|
||||||
|
|
||||||
# ~ s = objVertWtoS( scene, camera, portal )
|
# ~ s = objVertWtoS( scene, camera, portal )
|
||||||
@ -1734,7 +1784,6 @@ class ExportMyFormat(bpy.types.Operator, ExportHelper):
|
|||||||
# ~ print(0)
|
# ~ print(0)
|
||||||
PlanesRigidBodies[p] = { 'rigidbodies' : [ CleanName(moveable) ] }
|
PlanesRigidBodies[p] = { 'rigidbodies' : [ CleanName(moveable) ] }
|
||||||
|
|
||||||
|
|
||||||
# Find surrounding planes
|
# Find surrounding planes
|
||||||
|
|
||||||
for op in LvlPlanes:
|
for op in LvlPlanes:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user