Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(Vec3(1998.48425293, 1870.05358887, 639.38458252), Vec3(-121.682502747, 0.169744253159, 0.0)),
(Vec3(3910.55297852, 2370.70922852, 518.356567383), Vec3(-130.42376709, 3.65418696404, -0.000583928485867)),
(Vec3(4830.80761719, 1542.30749512, 501.019073486), Vec3(21.7212314606, 8.00974178314, 0.0)),
(Vec3(4324.81982422, 2259.2409668, 713.095458984), Vec3(-19.1500263214, -1.68137300014, 0.0)),
(Vec3(4584.38720703, 3417.75073242, 612.79510498), Vec3(-39.4675331116, -4.94804239273, 0.0)),
(Vec3(4569.68261719, 4840.80908203, 540.924926758), Vec3(-83.4887771606, 4.08973407745, 0.0)),
(Vec3(5061.6484375, 5490.93896484, 694.142578125), Vec3(-135.778717041, 0.605291008949, 0.0)),
(Vec3(6273.03222656, 6343.10546875, 769.735290527), Vec3(-200.826278687, -1.35470712185, 0.0)),
(Vec3(7355.02832031, 6314.39892578, 1164.65527344), Vec3(-262.645324707, -12.2435855865, 0.0)),
(Vec3(6321.42431641, 4453.68310547, 898.895202637), Vec3(-322.574157715, -2.22581481934, 0.0)),
(Vec3(4820.63916016, 4637.07128906, 793.165222168), Vec3(-330.291748047, 0.931967377663, 0.0)),
(Vec3(2621.3125, 4790.99072266, 691.223144531), Vec3(-423.059020996, 3.10974740982, 0.0)),
(Vec3(2166.64697266, 5683.75195312, 685.415039062), Vec3(-497.871612549, -1.57248008251, 0.0)),
(Vec3(2426.64135742, 7216.48974609, 993.247558594), Vec3(-524.17388916, -6.69025611877, 0.0)),
(Vec3(5014.83398438, 6712.60253906, 963.192810059), Vec3(-596.072387695, -3.31469583511, 0.00446693599224)),
(Vec3(6107.69970703, 5460.03662109, 820.63104248), Vec3(-650.567199707, 1.04085958004, 0.0)),
)
self.controller.play_motion_path(control_points, 3.0)
x_pos += 50 + 30
# Slider to adjust brightness
self._bright_slider = Slider(
parent=self._content_node, size=140, min_value=-14, max_value=14,
callback=self._set_brightness, x=x_pos, y=65, value=0)
x_pos += 140 + 5
self._bright_text = Text(
text="Bright: 1", parent=self._content_node, x=x_pos, y=72, size=18,
color=Vec3(0.4, 0.4, 1), may_change=1)
x_pos += 100 + 30
# Slider to enable reinhard tonemapping
self._tonemap_box = LabeledCheckbox(
parent=self._content_node, x=x_pos, y=60, text="Tonemap",
text_color=Vec3(1, 0.4, 0.4), chb_checked=False,
chb_callback=self._set_enable_tonemap,
text_size=18, expand_width=90)
x_pos += 90 + 30
image.set_shader_inputs(
slice=0,
mipmap=0,
brightness=1,
tonemap=False)
preview_shader = DisplayShaderBuilder.build(tex, display_w, display_h)
image.set_shader(preview_shader)
self._preview_image = image
self.show()
(Vec3(2140.57080078, 5625.22753906, 598.345031738), Vec3(-196.022613525, 1.91196918488, 0.0)),
(Vec3(2598.85961914, 3820.56958008, 627.692993164), Vec3(-272.410125732, 3.32752752304, 0.0)),
(Vec3(1894.64526367, 3597.39257812, 647.455078125), Vec3(-198.227630615, 0.605303645134, 0.0)),
(Vec3(1998.48425293, 1870.05358887, 639.38458252), Vec3(-121.682502747, 0.169744253159, 0.0)),
(Vec3(3910.55297852, 2370.70922852, 518.356567383), Vec3(-130.42376709, 3.65418696404, -0.000583928485867)),
(Vec3(4830.80761719, 1542.30749512, 501.019073486), Vec3(21.7212314606, 8.00974178314, 0.0)),
(Vec3(4324.81982422, 2259.2409668, 713.095458984), Vec3(-19.1500263214, -1.68137300014, 0.0)),
(Vec3(4584.38720703, 3417.75073242, 612.79510498), Vec3(-39.4675331116, -4.94804239273, 0.0)),
(Vec3(4569.68261719, 4840.80908203, 540.924926758), Vec3(-83.4887771606, 4.08973407745, 0.0)),
(Vec3(5061.6484375, 5490.93896484, 694.142578125), Vec3(-135.778717041, 0.605291008949, 0.0)),
(Vec3(6273.03222656, 6343.10546875, 769.735290527), Vec3(-200.826278687, -1.35470712185, 0.0)),
(Vec3(7355.02832031, 6314.39892578, 1164.65527344), Vec3(-262.645324707, -12.2435855865, 0.0)),
(Vec3(6321.42431641, 4453.68310547, 898.895202637), Vec3(-322.574157715, -2.22581481934, 0.0)),
(Vec3(4820.63916016, 4637.07128906, 793.165222168), Vec3(-330.291748047, 0.931967377663, 0.0)),
(Vec3(2621.3125, 4790.99072266, 691.223144531), Vec3(-423.059020996, 3.10974740982, 0.0)),
(Vec3(2166.64697266, 5683.75195312, 685.415039062), Vec3(-497.871612549, -1.57248008251, 0.0)),
(Vec3(2426.64135742, 7216.48974609, 993.247558594), Vec3(-524.17388916, -6.69025611877, 0.0)),
(Vec3(5014.83398438, 6712.60253906, 963.192810059), Vec3(-596.072387695, -3.31469583511, 0.00446693599224)),
(Vec3(6107.69970703, 5460.03662109, 820.63104248), Vec3(-650.567199707, 1.04085958004, 0.0)),
)
self.controller.play_motion_path(control_points, 3.0)
innerNode = NodePath(cm.generate())
innerNode.setTexture(Globals.loader.loadTexture("Data/GUI/Visualization/PointLight.png"))
innerNode.setBillboardPointEye()
innerNode.reparentTo(debugNode)
# Create the outer lines
lineNode = debugNode.attachNewNode("lines")
# Generate outer circles
points1 = []
points2 = []
points3 = []
for i in range(self.visualizationNumSteps + 1):
angle = float(
i) / float(self.visualizationNumSteps) * math.pi * 2.0
points1.append(Vec3(0, math.sin(angle), math.cos(angle)))
points2.append(Vec3(math.sin(angle), math.cos(angle), 0))
points3.append(Vec3(math.sin(angle), 0, math.cos(angle)))
self._createDebugLine(points1, False).reparentTo(lineNode)
self._createDebugLine(points2, False).reparentTo(lineNode)
self._createDebugLine(points3, False).reparentTo(lineNode)
lineNode.setScale(self.radius)
# Remove the old debug node
self.debugNode.node().removeAllChildren()
# Attach the new debug node
debugNode.reparentTo(self.debugNode)
# self.debugNode.flattenStrong()
# Voxelization from X-Axis
elif self._state == self.S_voxelize_x:
# Clear voxel grid
self._voxel_temp_grid.clear_image()
self._voxel_cam_np.set_pos(self._pta_next_grid_pos[0] + Vec3(self._voxel_ws, 0, 0))
self._voxel_cam_np.look_at(self._pta_next_grid_pos[0])
# Voxelization from Y-Axis
elif self._state == self.S_voxelize_y:
self._voxel_cam_np.set_pos(self._pta_next_grid_pos[0] + Vec3(0, self._voxel_ws, 0))
self._voxel_cam_np.look_at(self._pta_next_grid_pos[0])
# Voxelization from Z-Axis
elif self._state == self.S_voxelize_z:
self._voxel_cam_np.set_pos(self._pta_next_grid_pos[0] + Vec3(0, 0, self._voxel_ws))
self._voxel_cam_np.look_at(self._pta_next_grid_pos[0])
# Generate mipmaps
elif self._state == self.S_gen_mipmaps:
self._voxel_target.set_active(False)
self._copy_target.set_active(True)
self._voxel_cam_np.hide()
for target in self._mip_targets:
target.set_active(True)
# As soon as we generate the mipmaps, we need to update the grid position
# as well
self._pta_grid_pos[0] = self._pta_next_grid_pos[0]
def __init__(self):
DebugObject.__init__(self, "Light")
self._dirty = False
self._position = Vec3(0)
self._color = Vec3(0)
def applyCorrection(self, currentTimeStamp):
# add char's state to the speculative history
addState(self.posHistory, currentTimeStamp, self.node.getPos(), CLIENT_PREDICT_SAMPLES)
# apply most recent server update of local player as correction
correctTime, lastUpdateValue = NetEnt.samples[-1]
correctPosition = lastUpdateValue[self.id][0][1] #0 is char's node, 1 is node's pos
w0,s0,w1,s1 = takeStateSample(self.posHistory, correctTime)
specPosition = lerp3Tup(w0,s0,w1,s1)
print 'spec:', specPosition, ', correct:', correctPosition
error = Vec3(correctPosition) - Vec3(specPosition)
print 'error is ',error,
if error.length() > 5:
#aggressive error handling: delete incorrect history
truncateStates(self.posHistory, correctTime)
self.node.setPos(correctPosition)
print 'super correct'
else:
#simple error handling
if error.length() > 0.1:
error.normalize()
error *= 0.1
for timepos in self.posHistory:
for i in range(3):
timepos[1][i] += error[i]
self.node.setPos(self.node.getPos()+error)
print
def tour(self):
mopath = (
(Vec3(3.97601628304, -15.5422525406, 1.73230814934), Vec3(49.2462043762, -11.7619161606, 0.0)),
(Vec3(4.37102460861, -6.52981519699, 2.84148645401), Vec3(138.54864502, -15.7908058167, 0.0)),
(Vec3(-5.88968038559, -13.9816446304, 2.44033527374), Vec3(302.348571777, -13.2863616943, 0.0)),
(Vec3(5.23844909668, -18.1897411346, 4.54698801041), Vec3(402.91229248, -14.7019147873, 0.0)),
(Vec3(-7.27328443527, -0.466051012278, 3.30696845055), Vec3(607.032165527, -19.6019115448, 0.0)),
(Vec3(5.33415555954, 1.92750489712, 2.53945565224), Vec3(484.103546143, -11.9796953201, 0.0)),
(Vec3(-0.283608138561, -6.86583900452, 1.43702816963), Vec3(354.63848877, -4.79302883148, 0.0)),
(Vec3(-11.7576808929, 7.0855755806, 3.40899515152), Vec3(272.73840332, -12.959692955, 0.0)),
(Vec3(7.75462722778, 13.220041275, 3.97876667976), Vec3(126.342140198, -19.4930171967, 0.0)),
(Vec3(-2.10827493668, 4.78230571747, 1.27567899227), Vec3(-40.1353683472, -5.77301359177, 0.0)),
(Vec3(8.67115211487, 16.9084873199, 3.72598099709), Vec3(89.5658569336, -10.9996757507, 0.0)),
(Vec3(-8.1254825592, 26.6411190033, 3.21335697174), Vec3(268.092102051, -12.1974525452, 0.0)),
(Vec3(7.89382314682, 45.8911399841, 4.47727441788), Vec3(498.199554443, -11.3263425827, 0.0)),
(Vec3(-2.33054184914, 43.8977775574, 1.86498868465), Vec3(551.198242188, 13.6092195511, 0.0)),
(Vec3(4.80335664749, 36.9664497375, 6.16300296783), Vec3(810.128417969, -10.6730031967, 0.0)),
(Vec3(45.0654678345, 7.54712438583, 22.2645874023), Vec3(808.238586426, -17.5330123901, 0.0)),
(Vec3(5.99377584457, -12.3760728836, 4.53536558151), Vec3(806.978820801, -2.39745855331, 0.0)),
(Vec3(6.05853939056, -1.72227275372, 4.53848743439), Vec3(809.65637207, -2.39745855331, 0.0)),
(Vec3(4.81568479538, 8.28769683838, 4.48393821716), Vec3(809.65637207, -2.39745855331, 0.0)),
(Vec3(5.82831144333, 17.5230751038, 4.52401590347), Vec3(809.65637207, -2.39745855331, 0.0)),
(Vec3(4.09594917297, 26.7909412384, 4.44915866852), Vec3(809.65637207, -2.39745855331, 0.0)),
(Vec3(4.39108037949, 37.2143096924, 5.16932630539), Vec3(809.65637207, -2.39745855331, 0.0)),
)
self.controller.play_motion_path(mopath, 2.3)
def _precomputeScattering(self):
""" Precomputes the scattering model for the default atmosphere if
specified in the settings """
if self.settings.enableScattering:
earthScattering = Scattering(self)
scale = 150
earthScattering.setSettings({
"atmosphereOffset": Vec3(0, 0, - (6360.0 + 0.7) * scale),
"atmosphereScale": Vec3(scale)
})
earthScattering.precompute()
earthScattering.provideInputs()
self.scattering = earthScattering
else:
self.scattering = None
def _create_stats(self):
""" Creates the stats overlay """
self._overlay_node = Globals.base.aspect2d.attach_new_node("Overlay")
self._overlay_node.set_pos(Globals.base.getAspectRatio() - 0.07, 1, 1.0 - 0.07)
self._debug_lines = []
for i in range(4):
self._debug_lines.append(FastTextNode(
pos=Vec2(0, -i * 0.046), parent=self._overlay_node,
pixel_size=16, align="right", color=Vec3(1)))