Skip to content

Commit 66ac3be

Browse files
committed
Merge branch 'release/1.10.x' into master
2 parents 16f489a + 0c2f8fe commit 66ac3be

38 files changed

+494
-127
lines changed

contrib/src/rplight/rpLight.I

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ inline void RPLight::assign_slot(int slot) {
148148
* changed. This will cause all shadow sources to be updated, emitting a
149149
* shadow update. Be careful when calling this method if you don't want all
150150
* sources to get updated. If you only have to invalidate a single shadow source,
151-
* use get_shadow_source(n)->set_needs_update(true).
151+
* use `get_shadow_source(n)->set_needs_update(true)`.
152152
*/
153153
inline void RPLight::invalidate_shadows() {
154154
for (size_t i = 0; i < _shadow_sources.size(); ++i) {
@@ -296,14 +296,14 @@ inline bool RPLight::get_casts_shadows() const {
296296
}
297297

298298
/**
299-
* @brief Sets the lights shadow map resolution
300-
* @details This sets the lights shadow map resolution. This has no effect
299+
* @brief Sets the light's shadow map resolution
300+
* @details This sets the light's shadow map resolution. This has no effect
301301
* when the light is not told to cast shadows (Use RPLight::set_casts_shadows).
302302
*
303-
* When calling this on a light with multiple shadow sources (e.g. PointLight),
304-
* this controls the resolution of each source. If the light has 6 shadow sources,
305-
* and you use a resolution of 512x512, the lights shadow map will occur a
306-
* space of 6 * 512x512 maps in the shadow atlas.
303+
* When calling this on a light with multiple shadow sources (e.g.
304+
* RPPointLight), this controls the resolution of each source. If the light
305+
* has 6 shadow sources, and you use a resolution of 512x512, the light's
306+
* shadow map will occupy a space of 6 * 512x512 maps in the shadow atlas.
307307
*
308308
* @param resolution Resolution of the shadow map in pixels
309309
*/
@@ -326,14 +326,14 @@ inline size_t RPLight::get_shadow_map_resolution() const {
326326
}
327327

328328
/**
329-
* @brief Sets the ies profile
329+
* @brief Sets the IES profile
330330
* @details This sets the ies profile of the light. The parameter should be a
331331
* handle previously returned by RenderPipeline.load_ies_profile. Using a
332332
* value of -1 indicates no ies profile.
333333
*
334-
* Notice that for ies profiles which cover a whole range, you should use
335-
* PointLights, whereas for ies profiles which only cover the lower hemisphere
336-
* you should use SpotLights for the best performance.
334+
* Notice that for IES profiles which cover a whole range, you should use an
335+
* RPPointLight, whereas for ies profiles which only cover the lower
336+
* hemisphere you should use an RPSpotLight for the best performance.
337337
*
338338
* @param profile IES Profile handle
339339
*/
@@ -343,8 +343,8 @@ inline void RPLight::set_ies_profile(int profile) {
343343
}
344344

345345
/**
346-
* @brief Returns the lights ies profile
347-
* @details This returns the ies profile of a light, previously set with
346+
* @brief Returns the light's IES profile
347+
* @details This returns the IES profile of a light, previously set with
348348
* RPLight::set_ies_profile. In case no ies profile was set, returns -1.
349349
*
350350
* @return IES Profile handle
@@ -354,20 +354,20 @@ inline int RPLight::get_ies_profile() const {
354354
}
355355

356356
/**
357-
* @brief Returns whether the light has an ies profile assigned
358-
* @details This returns whether the light has an ies profile assigned,
357+
* @brief Returns whether the light has an IES profile assigned
358+
* @details This returns whether the light has an IES profile assigned,
359359
* previously done with RPLight::set_ies_profile.
360360
*
361-
* @return true if the light has an ies profile assigned, false otherwise
361+
* @return true if the light has an IES profile assigned, false otherwise
362362
*/
363363
inline bool RPLight::has_ies_profile() const {
364364
return _ies_profile >= 0;
365365
}
366366

367367
/**
368-
* @brief Clears the ies profile
369-
* @details This clears the ies profile of the light, telling it to no longer
370-
* use an ies profile, and instead use the default attenuation.
368+
* @brief Clears the IES profile
369+
* @details This clears the IES profile of the light, telling it to no longer
370+
* use an IES profile, and instead use the default attenuation.
371371
*/
372372
inline void RPLight::clear_ies_profile() {
373373
set_ies_profile(-1);
@@ -377,7 +377,7 @@ inline void RPLight::clear_ies_profile() {
377377
* @brief Sets the near plane of the light
378378
* @details This sets the near plane of all shadow sources of the light. It has
379379
* no effects if the light does not cast shadows. This prevents artifacts from
380-
* objects near to the light. It behaves like Lens::set_near_plane.
380+
* objects near to the light. It behaves like Lens::set_near().
381381
*
382382
* It can also help increasing shadow map precision, low near planes will
383383
* cause the precision to suffer. Try setting the near plane as big as possible.
@@ -394,7 +394,7 @@ inline void RPLight::set_near_plane(float near_plane) {
394394

395395
/**
396396
* @brief Returns the near plane of the light
397-
* @details This returns the lights near plane, previously set with
397+
* @details This returns the light's near plane, previously set with
398398
* RPLight::set_near_plane. If the light does not cast shadows, this value
399399
* is meaningless.
400400
*

direct/src/actor/Actor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
"""Actor module: contains the Actor class"""
1+
"""Actor module: contains the Actor class.
2+
3+
See the :ref:`models-and-actors` page in the Programming Guide to learn
4+
more about loading models and animated actors.
5+
"""
26

37
__all__ = ['Actor']
48

direct/src/actor/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44
the lower-level :class:`panda3d.core.Character` implementation.
55
It loads and controls an animated character and manages the animations
66
playing on it.
7+
8+
See the :ref:`models-and-actors` page in the Programming Guide to learn
9+
more about loading models and animated actors.
710
"""

direct/src/directscripts/Doxyfile.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ RECURSIVE = YES
789789
EXCLUDE = dtool/src/parser-inc \
790790
dtool/src/cppparser \
791791
dtool/src/interrogate \
792+
direct/src/directscripts \
792793
direct/src/plugin \
793794
direct/src/plugin_standalone \
794795
direct/src/plugin_npapi \

direct/src/dist/commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,13 @@ def download_wheels(self, platform):
369369
os.remove(os.path.join(whldir, whl))
370370

371371
pip_args = [
372+
'--disable-pip-version-check',
372373
'download',
373374
'-d', whldir,
374375
'-r', self.requirements_path,
375376
'--only-binary', ':all:',
376377
'--platform', platform,
377-
'--abi', abi_tag
378+
'--abi', abi_tag,
378379
]
379380

380381
if self.use_optimized_wheels:

direct/src/distributed/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
This package contains an implementation of the Distributed Networking
33
API, a high-level networking system that automatically propagates
44
changes made on distributed objects to interested clients.
5+
6+
See the :ref:`distributed-networking` section of the Programming Guide to
7+
learn more about the distributed networking system.
58
"""

direct/src/filter/CommonFilters.py

Lines changed: 119 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
22
33
Class CommonFilters implements certain common image
4-
postprocessing filters.
4+
postprocessing filters. See the :ref:`common-image-filters` page for
5+
more information about how to use these filters.
56
67
It is not ideal that these filters are all included in a single
78
monolithic module. Unfortunately, when you want to apply two filters
@@ -27,6 +28,7 @@
2728
from panda3d.core import Filename
2829
from panda3d.core import AuxBitplaneAttrib
2930
from panda3d.core import Texture, Shader, ATSNone
31+
from panda3d.core import FrameBufferProperties
3032
import os
3133

3234
CARTOON_BODY="""
@@ -177,7 +179,15 @@ def reconfigure(self, fullrebuild, changed):
177179
self.textures[tex].setWrapU(Texture.WMClamp)
178180
self.textures[tex].setWrapV(Texture.WMClamp)
179181

180-
self.finalQuad = self.manager.renderSceneInto(textures = self.textures, auxbits=auxbits)
182+
fbprops = None
183+
clamping = None
184+
if "HighDynamicRange" in configuration:
185+
fbprops = FrameBufferProperties()
186+
fbprops.setFloatColor(True)
187+
fbprops.setSrgbColor(False)
188+
clamping = False
189+
190+
self.finalQuad = self.manager.renderSceneInto(textures = self.textures, auxbits=auxbits, fbprops=fbprops, clamping=clamping)
181191
if (self.finalQuad == None):
182192
self.cleanup()
183193
return False
@@ -255,6 +265,17 @@ def reconfigure(self, fullrebuild, changed):
255265
texcoordSets = list(enumerate(texcoordPadding.keys()))
256266

257267
text = "//Cg\n"
268+
if "HighDynamicRange" in configuration:
269+
text += "static const float3x3 aces_input_mat = {\n"
270+
text += " {0.59719, 0.35458, 0.04823},\n"
271+
text += " {0.07600, 0.90834, 0.01566},\n"
272+
text += " {0.02840, 0.13383, 0.83777},\n"
273+
text += "};\n"
274+
text += "static const float3x3 aces_output_mat = {\n"
275+
text += " { 1.60475, -0.53108, -0.07367},\n"
276+
text += " {-0.10208, 1.10813, -0.00605},\n"
277+
text += " {-0.00327, -0.07276, 1.07602},\n"
278+
text += "};\n"
258279
text += "void vshader(float4 vtx_position : POSITION,\n"
259280
text += " out float4 l_position : POSITION,\n"
260281

@@ -301,6 +322,10 @@ def reconfigure(self, fullrebuild, changed):
301322
if ("VolumetricLighting" in configuration):
302323
text += " uniform float4 k_casterpos,\n"
303324
text += " uniform float4 k_vlparams,\n"
325+
326+
if ("ExposureAdjust" in configuration):
327+
text += " uniform float k_exposure,\n"
328+
304329
text += " out float4 o_color : COLOR)\n"
305330
text += "{\n"
306331
text += " o_color = tex2D(k_txcolor, %s);\n" % (texcoords["color"])
@@ -332,6 +357,14 @@ def reconfigure(self, fullrebuild, changed):
332357
text += " }\n"
333358
text += " o_color += float4(vlcolor * k_vlparams.z, 1);\n"
334359

360+
if ("ExposureAdjust" in configuration):
361+
text += " o_color.rgb *= k_exposure;\n"
362+
363+
# With thanks to Stephen Hill!
364+
if ("HighDynamicRange" in configuration):
365+
text += " float3 aces_color = mul(aces_input_mat, o_color.rgb);\n"
366+
text += " o_color.rgb = saturate(mul(aces_output_mat, (aces_color * (aces_color + 0.0245786f) - 0.000090537f) / (aces_color * (0.983729f * aces_color + 0.4329510f) + 0.238081f)));\n"
367+
335368
if ("GammaAdjust" in configuration):
336369
gamma = configuration["GammaAdjust"]
337370
if gamma == 0.5:
@@ -341,6 +374,11 @@ def reconfigure(self, fullrebuild, changed):
341374
elif gamma != 1.0:
342375
text += " o_color.rgb = pow(o_color.rgb, %ff);\n" % (gamma)
343376

377+
if ("SrgbEncode" in configuration):
378+
text += " o_color.r = (o_color.r < 0.0031308) ? (o_color.r * 12.92) : (1.055 * pow(o_color.r, 0.41666) - 0.055);\n"
379+
text += " o_color.g = (o_color.g < 0.0031308) ? (o_color.g * 12.92) : (1.055 * pow(o_color.g, 0.41666) - 0.055);\n"
380+
text += " o_color.b = (o_color.b < 0.0031308) ? (o_color.b * 12.92) : (1.055 * pow(o_color.b, 0.41666) - 0.055);\n"
381+
344382
if ("Inverted" in configuration):
345383
text += " o_color = float4(1, 1, 1, 1) - o_color;\n"
346384
text += "}\n"
@@ -386,6 +424,11 @@ def reconfigure(self, fullrebuild, changed):
386424
self.ssao[0].setShaderInput("params1", config.numsamples, -float(config.amount) / config.numsamples, config.radius, 0)
387425
self.ssao[0].setShaderInput("params2", config.strength, config.falloff, 0, 0)
388426

427+
if (changed == "ExposureAdjust") or fullrebuild:
428+
if ("ExposureAdjust" in configuration):
429+
stops = configuration["ExposureAdjust"]
430+
self.finalQuad.setShaderInput("exposure", 2 ** stops)
431+
389432
self.update()
390433
return True
391434

@@ -547,6 +590,73 @@ def delGammaAdjust(self):
547590
return self.reconfigure((old_gamma != 1.0), "GammaAdjust")
548591
return True
549592

593+
def setSrgbEncode(self, force=False):
594+
""" Applies the inverse sRGB EOTF to the output, unless the window
595+
already has an sRGB framebuffer, in which case this filter refuses to
596+
apply, to prevent accidental double-application.
597+
598+
Set the force argument to True to force it to be applied in all cases.
599+
600+
.. versionadded:: 1.10.7
601+
"""
602+
new_enable = force or not self.manager.win.getFbProperties().getSrgbColor()
603+
old_enable = self.configuration.get("SrgbEncode", False)
604+
if new_enable and not old_enable:
605+
self.configuration["SrgbEncode"] = True
606+
return self.reconfigure(True, "SrgbEncode")
607+
elif not new_enable and old_enable:
608+
del self.configuration["SrgbEncode"]
609+
return new_enable
610+
611+
def delSrgbEncode(self):
612+
""" Reverses the effects of setSrgbEncode. """
613+
if ("SrgbEncode" in self.configuration):
614+
old_enable = self.configuration["SrgbEncode"]
615+
del self.configuration["SrgbEncode"]
616+
return self.reconfigure(old_enable, "SrgbEncode")
617+
return True
618+
619+
def setHighDynamicRange(self):
620+
""" Enables HDR rendering by using a floating-point framebuffer,
621+
disabling color clamping on the main scene, and applying a tone map
622+
operator (ACES).
623+
624+
It may also be necessary to use setExposureAdjust to perform exposure
625+
compensation on the scene, depending on the lighting intensity.
626+
627+
.. versionadded:: 1.10.7
628+
"""
629+
630+
fullrebuild = (("HighDynamicRange" in self.configuration) is False)
631+
self.configuration["HighDynamicRange"] = 1
632+
return self.reconfigure(fullrebuild, "HighDynamicRange")
633+
634+
def delHighDynamicRange(self):
635+
if ("HighDynamicRange" in self.configuration):
636+
del self.configuration["HighDynamicRange"]
637+
return self.reconfigure(True, "HighDynamicRange")
638+
return True
639+
640+
def setExposureAdjust(self, stops):
641+
""" Sets a relative exposure adjustment to multiply with the result of
642+
rendering the scene, in stops. A value of 0 means no adjustment, a
643+
positive value will result in a brighter image. Useful in conjunction
644+
with HDR, see setHighDynamicRange.
645+
646+
.. versionadded:: 1.10.7
647+
"""
648+
old_stops = self.configuration.get("ExposureAdjust")
649+
if old_stops != stops:
650+
self.configuration["ExposureAdjust"] = stops
651+
return self.reconfigure(old_stops is None, "ExposureAdjust")
652+
return True
653+
654+
def delExposureAdjust(self):
655+
if ("ExposureAdjust" in self.configuration):
656+
del self.configuration["ExposureAdjust"]
657+
return self.reconfigure(True, "ExposureAdjust")
658+
return True
659+
550660
#snake_case alias:
551661
del_cartoon_ink = delCartoonInk
552662
set_half_pixel_shift = setHalfPixelShift
@@ -555,7 +665,6 @@ def delGammaAdjust(self):
555665
del_inverted = delInverted
556666
del_view_glow = delViewGlow
557667
set_volumetric_lighting = setVolumetricLighting
558-
del_gamma_adjust = delGammaAdjust
559668
set_bloom = setBloom
560669
set_view_glow = setViewGlow
561670
set_ambient_occlusion = setAmbientOcclusion
@@ -566,3 +675,10 @@ def delGammaAdjust(self):
566675
del_blur_sharpen = delBlurSharpen
567676
del_volumetric_lighting = delVolumetricLighting
568677
set_gamma_adjust = setGammaAdjust
678+
del_gamma_adjust = delGammaAdjust
679+
set_srgb_encode = setSrgbEncode
680+
del_srgb_encode = delSrgbEncode
681+
set_exposure_adjust = setExposureAdjust
682+
del_exposure_adjust = delExposureAdjust
683+
set_high_dynamic_range = setHighDynamicRange
684+
del_high_dynamic_range = delHighDynamicRange

direct/src/filter/FilterManager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
The FilterManager is a convenience class that helps with the creation
44
of render-to-texture buffers for image postprocessing applications.
55
6+
See :ref:`generalized-image-filters` for information on how to use this class.
7+
68
Still need to implement:
79
810
* Make sure sort-order of buffers is correct.
@@ -22,6 +24,7 @@
2224
from panda3d.core import Camera
2325
from panda3d.core import OrthographicLens
2426
from panda3d.core import AuxBitplaneAttrib
27+
from panda3d.core import LightRampAttrib
2528
from direct.directnotify.DirectNotifyGlobal import *
2629
from direct.showbase.DirectObject import DirectObject
2730

@@ -124,7 +127,7 @@ def getScaledSize(self, mul, div, align):
124127

125128
return winx,winy
126129

127-
def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0, textures=None, fbprops=None):
130+
def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0, textures=None, fbprops=None, clamping=None):
128131

129132
""" Causes the scene to be rendered into the supplied textures
130133
instead of into the original window. Puts a fullscreen quad
@@ -207,6 +210,9 @@ def renderSceneInto(self, depthtex=None, colortex=None, auxtex=None, auxbits=0,
207210
#cs.setShaderAuto()
208211
if (auxbits):
209212
cs.setAttrib(AuxBitplaneAttrib.make(auxbits))
213+
if clamping is False:
214+
# Disables clamping in the shader generator.
215+
cs.setAttrib(LightRampAttrib.make_identity())
210216
self.camera.node().setInitialState(cs.getState())
211217

212218
quadcamnode = Camera("filter-quad-cam")

direct/src/filter/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
The :class:`.CommonFilters` class contains various filters that are
99
provided out of the box, whereas the :class:`.FilterManager` class
1010
is a lower-level class that allows you to set up your own filters.
11+
12+
See the :ref:`render-to-texture-and-image-postprocessing` section of the
13+
Programming Guide to learn more about image postprocessing in Panda3D.
1114
"""

direct/src/showbase/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
""" This package contains `.ShowBase`, an application framework responsible
2+
for opening a graphical display, setting up input devices and creating
3+
the scene graph. """

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy