mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Fixed bug in COA marker scaling
This commit is contained in:
parent
d13afc82cf
commit
ae4e0deb32
@ -2,6 +2,7 @@ from direct.showbase.PandaObject import *
|
|||||||
from DirectUtil import *
|
from DirectUtil import *
|
||||||
from DirectGeometry import *
|
from DirectGeometry import *
|
||||||
from DirectGlobals import *
|
from DirectGlobals import *
|
||||||
|
from direct.interval.IntervalGlobal import Sequence, Func
|
||||||
from direct.task import Task
|
from direct.task import Task
|
||||||
|
|
||||||
CAM_MOVE_DURATION = 1.2
|
CAM_MOVE_DURATION = 1.2
|
||||||
@ -23,6 +24,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
self.coaMarker.setPos(0,100,0)
|
self.coaMarker.setPos(0,100,0)
|
||||||
useDirectRenderStyle(self.coaMarker)
|
useDirectRenderStyle(self.coaMarker)
|
||||||
self.coaMarkerPos = Point3(0)
|
self.coaMarkerPos = Point3(0)
|
||||||
|
self.coaMarkerColorIval = None
|
||||||
self.fLockCOA = 0
|
self.fLockCOA = 0
|
||||||
self.nullHitPointCount = 0
|
self.nullHitPointCount = 0
|
||||||
self.cqEntries = []
|
self.cqEntries = []
|
||||||
@ -383,15 +385,23 @@ class DirectCameraControl(PandaObject):
|
|||||||
def updateCoaMarkerSize(self, coaDist = None):
|
def updateCoaMarkerSize(self, coaDist = None):
|
||||||
if not coaDist:
|
if not coaDist:
|
||||||
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
coaDist = Vec3(self.coaMarker.getPos(direct.camera)).length()
|
||||||
# KEH: use current display region for fov
|
# Nominal size based on default 30 degree vertical FOV
|
||||||
# sf = COA_MARKER_SF * coaDist * math.tan(deg2Rad(direct.dr.fovV))
|
# Need to adjust size based on distance and current FOV
|
||||||
sf = COA_MARKER_SF * coaDist * math.tan(deg2Rad(direct.drList.getCurrentDr().fovV))
|
sf = COA_MARKER_SF * coaDist * (direct.drList.getCurrentDr().fovV/30.0)
|
||||||
if sf == 0.0:
|
if sf == 0.0:
|
||||||
sf = 0.1
|
sf = 0.1
|
||||||
self.coaMarker.setScale(sf)
|
self.coaMarker.setScale(sf)
|
||||||
# Lerp color to fade out
|
# Lerp color to fade out
|
||||||
self.coaMarker.lerpColor(VBase4(1,0,0,1), VBase4(1,0,0,0), 3.0,
|
if self.coaMarkerColorIval:
|
||||||
task = 'fadeAway')
|
self.coaMarkerColorIval.finish()
|
||||||
|
self.coaMarkerColorIval = Sequence(
|
||||||
|
Func(self.coaMarker.unstash),
|
||||||
|
self.coaMarker.colorInterval(1.5, Vec4(1,0,0,0),
|
||||||
|
startColor = Vec4(1,0,0,1),
|
||||||
|
blendType = 'easeInOut'),
|
||||||
|
Func(self.coaMarker.stash)
|
||||||
|
)
|
||||||
|
self.coaMarkerColorIval.start()
|
||||||
|
|
||||||
def homeCam(self):
|
def homeCam(self):
|
||||||
# Record undo point
|
# Record undo point
|
||||||
|
Loading…
x
Reference in New Issue
Block a user