OpenGLContext 3.0.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- OpenGLContext/__init__.py +151 -0
- OpenGLContext/arrays.py +2 -0
- OpenGLContext/atlas.py +300 -0
- OpenGLContext/audio/__init__.py +32 -0
- OpenGLContext/audio/scene.py +130 -0
- OpenGLContext/audio/settings.py +82 -0
- OpenGLContext/bin/__init__.py +0 -0
- OpenGLContext/bin/choosecontext.py +224 -0
- OpenGLContext/bin/choosefonts.py +209 -0
- OpenGLContext/bin/gltest.py +121 -0
- OpenGLContext/bin/gltf_demo.py +492 -0
- OpenGLContext/bin/gltf_regression.py +645 -0
- OpenGLContext/bin/gltf_view.py +30 -0
- OpenGLContext/bin/keyboardevents.py +93 -0
- OpenGLContext/bin/lorentz.py +109 -0
- OpenGLContext/bin/physics_cook.py +81 -0
- OpenGLContext/bin/profile_view.py +38 -0
- OpenGLContext/bin/terrain_view.py +581 -0
- OpenGLContext/bin/tiles_view.py +39 -0
- OpenGLContext/bin/ui_demo.py +228 -0
- OpenGLContext/bin/view.py +341 -0
- OpenGLContext/bin/vrml_view.py +42 -0
- OpenGLContext/capture.py +125 -0
- OpenGLContext/context.py +1253 -0
- OpenGLContext/contextconfig.py +177 -0
- OpenGLContext/contextdefinition.py +275 -0
- OpenGLContext/debug/__init__.py +6 -0
- OpenGLContext/debug/bufferimage.py +80 -0
- OpenGLContext/debug/leaks.py +13 -0
- OpenGLContext/debug/logcontext.py +9 -0
- OpenGLContext/debug/logs.py +15 -0
- OpenGLContext/debug/state.py +329 -0
- OpenGLContext/displaylist.py +69 -0
- OpenGLContext/doinchildmatrix.py +34 -0
- OpenGLContext/drawcube.py +58 -0
- OpenGLContext/events/__init__.py +10 -0
- OpenGLContext/events/default_config.py +29 -0
- OpenGLContext/events/event.py +65 -0
- OpenGLContext/events/eventhandlermixin.py +214 -0
- OpenGLContext/events/eventmanager.py +269 -0
- OpenGLContext/events/fxevents.py +90 -0
- OpenGLContext/events/glfwevents.py +424 -0
- OpenGLContext/events/glutevents.py +184 -0
- OpenGLContext/events/inputstate.py +129 -0
- OpenGLContext/events/internaltime.py +161 -0
- OpenGLContext/events/keyboardevents.py +153 -0
- OpenGLContext/events/mouseevents.py +473 -0
- OpenGLContext/events/pygameevents.py +162 -0
- OpenGLContext/events/systemtime.py +12 -0
- OpenGLContext/events/timeeventgeneratormanager.py +40 -0
- OpenGLContext/events/timeevents.py +143 -0
- OpenGLContext/events/timer.py +170 -0
- OpenGLContext/events/tkevents.py +172 -0
- OpenGLContext/events/wxevents.py +185 -0
- OpenGLContext/extensionmanager.py +158 -0
- OpenGLContext/framecounter.py +74 -0
- OpenGLContext/frustum.py +135 -0
- OpenGLContext/glfwcontext.py +395 -0
- OpenGLContext/glfwinteractivecontext.py +34 -0
- OpenGLContext/glfwvrmlcontext.py +11 -0
- OpenGLContext/glutcontext.py +224 -0
- OpenGLContext/glutinteractivecontext.py +24 -0
- OpenGLContext/gluttestingcontext.py +11 -0
- OpenGLContext/glutvrmlcontext.py +25 -0
- OpenGLContext/glutvrmltestingcontext.py +48 -0
- OpenGLContext/hud.py +404 -0
- OpenGLContext/interactivecontext.py +29 -0
- OpenGLContext/loaders/__init__.py +1 -0
- OpenGLContext/loaders/base.py +84 -0
- OpenGLContext/loaders/cc0.py +137 -0
- OpenGLContext/loaders/gltf/__init__.py +71 -0
- OpenGLContext/loaders/gltf/accessors.py +255 -0
- OpenGLContext/loaders/gltf/animation.py +611 -0
- OpenGLContext/loaders/gltf/draco.py +166 -0
- OpenGLContext/loaders/gltf/environment_sky.py +416 -0
- OpenGLContext/loaders/gltf/loader.py +80 -0
- OpenGLContext/loaders/gltf/materials.py +298 -0
- OpenGLContext/loaders/gltf/meshes.py +292 -0
- OpenGLContext/loaders/gltf/samples.py +162 -0
- OpenGLContext/loaders/gltf/scene.py +673 -0
- OpenGLContext/loaders/gltf/specular_glossiness.py +154 -0
- OpenGLContext/loaders/gltf/textures.py +155 -0
- OpenGLContext/loaders/gltf/transforms.py +261 -0
- OpenGLContext/loaders/gltf_demos.py +511 -0
- OpenGLContext/loaders/hdr.py +228 -0
- OpenGLContext/loaders/hdri.py +83 -0
- OpenGLContext/loaders/loader.py +255 -0
- OpenGLContext/loaders/obj.py +299 -0
- OpenGLContext/loaders/resolver.py +536 -0
- OpenGLContext/loaders/tiles3d/__init__.py +9 -0
- OpenGLContext/loaders/tiles3d/boundingvolume.py +120 -0
- OpenGLContext/loaders/tiles3d/dem.py +71 -0
- OpenGLContext/loaders/tiles3d/fetch.py +102 -0
- OpenGLContext/loaders/tiles3d/foliage.py +786 -0
- OpenGLContext/loaders/tiles3d/frustum.py +70 -0
- OpenGLContext/loaders/tiles3d/geomorph.py +57 -0
- OpenGLContext/loaders/tiles3d/gltf_uploader.py +246 -0
- OpenGLContext/loaders/tiles3d/loadmanager.py +121 -0
- OpenGLContext/loaders/tiles3d/physics_colliders.py +78 -0
- OpenGLContext/loaders/tiles3d/procedural.py +355 -0
- OpenGLContext/loaders/tiles3d/residency.py +102 -0
- OpenGLContext/loaders/tiles3d/runtime.py +168 -0
- OpenGLContext/loaders/tiles3d/sample.py +212 -0
- OpenGLContext/loaders/tiles3d/scatter.py +77 -0
- OpenGLContext/loaders/tiles3d/screenspaceerror.py +31 -0
- OpenGLContext/loaders/tiles3d/tileset.py +390 -0
- OpenGLContext/loaders/tiles3d/traversal.py +108 -0
- OpenGLContext/loaders/tiles3d/vegetation.py +361 -0
- OpenGLContext/loaders/vrml97.py +133 -0
- OpenGLContext/looptrace.py +307 -0
- OpenGLContext/move/__init__.py +0 -0
- OpenGLContext/move/bindingstore.py +232 -0
- OpenGLContext/move/direct.py +156 -0
- OpenGLContext/move/dragwatcher.py +42 -0
- OpenGLContext/move/examinemanager.py +100 -0
- OpenGLContext/move/followcam.py +121 -0
- OpenGLContext/move/modes.py +522 -0
- OpenGLContext/move/movementmanager.py +74 -0
- OpenGLContext/move/navigation.py +137 -0
- OpenGLContext/move/physicsplatform.py +203 -0
- OpenGLContext/move/physicswalk.py +469 -0
- OpenGLContext/move/smooth.py +68 -0
- OpenGLContext/move/terrainwalk.py +451 -0
- OpenGLContext/move/trackball.py +92 -0
- OpenGLContext/move/viewplatform.py +283 -0
- OpenGLContext/move/viewplatformmixin.py +335 -0
- OpenGLContext/nav/__init__.py +13 -0
- OpenGLContext/nav/navmesh.py +476 -0
- OpenGLContext/passes/__init__.py +0 -0
- OpenGLContext/passes/_flat.py +1317 -0
- OpenGLContext/passes/asyncpick.py +216 -0
- OpenGLContext/passes/bloom.py +257 -0
- OpenGLContext/passes/flatcompat.py +246 -0
- OpenGLContext/passes/flatcore.py +198 -0
- OpenGLContext/passes/flateffects.py +372 -0
- OpenGLContext/passes/ibl.py +711 -0
- OpenGLContext/passes/instancing.py +775 -0
- OpenGLContext/passes/pbrpass.py +829 -0
- OpenGLContext/passes/renderpass.py +79 -0
- OpenGLContext/passes/renderstats.py +55 -0
- OpenGLContext/passes/rendervisitor.py +60 -0
- OpenGLContext/passes/selection.py +450 -0
- OpenGLContext/passes/selectionbuffers.py +442 -0
- OpenGLContext/passes/shaderpass.py +1018 -0
- OpenGLContext/passes/shaderpass_shadow.py +197 -0
- OpenGLContext/passes/shadersource.py +121 -0
- OpenGLContext/passes/shadowcaps.py +182 -0
- OpenGLContext/passes/shadowmap.py +330 -0
- OpenGLContext/passes/shadowmath.py +290 -0
- OpenGLContext/passes/shadowmixin.py +906 -0
- OpenGLContext/passes/shadowpool.py +186 -0
- OpenGLContext/passes/transmission.py +124 -0
- OpenGLContext/physics/__init__.py +16 -0
- OpenGLContext/physics/debugdraw.py +370 -0
- OpenGLContext/physics/demo.py +157 -0
- OpenGLContext/physics/gltf_world.py +185 -0
- OpenGLContext/physics/manager.py +84 -0
- OpenGLContext/physics/threaded.py +93 -0
- OpenGLContext/plugins.py +61 -0
- OpenGLContext/pygamecontext.py +178 -0
- OpenGLContext/pygameinteractivecontext.py +36 -0
- OpenGLContext/pygametestingcontext.py +10 -0
- OpenGLContext/pygamevrmlcontext.py +13 -0
- OpenGLContext/quaternion.py +190 -0
- OpenGLContext/renderoptions.py +280 -0
- OpenGLContext/resources/__init__.py +36 -0
- OpenGLContext/resources/available_contexts.txt +4 -0
- OpenGLContext/resources/available_contexts_txt.py +9 -0
- OpenGLContext/resources/context_icon_png.py +46 -0
- OpenGLContext/resources/context_icon_small_png.py +21 -0
- OpenGLContext/resources/disk_icon_hi_png.py +14 -0
- OpenGLContext/resources/disk_icon_png.py +15 -0
- OpenGLContext/resources/environment/pimbackground_BK.jpg +0 -0
- OpenGLContext/resources/environment/pimbackground_DN.jpg +0 -0
- OpenGLContext/resources/environment/pimbackground_FR.jpg +0 -0
- OpenGLContext/resources/environment/pimbackground_LF.jpg +0 -0
- OpenGLContext/resources/environment/pimbackground_RT.jpg +0 -0
- OpenGLContext/resources/environment/pimbackground_UP.jpg +0 -0
- OpenGLContext/resources/environment/studio_BK.jpg +0 -0
- OpenGLContext/resources/environment/studio_DN.jpg +0 -0
- OpenGLContext/resources/environment/studio_FR.jpg +0 -0
- OpenGLContext/resources/environment/studio_LF.jpg +0 -0
- OpenGLContext/resources/environment/studio_RT.jpg +0 -0
- OpenGLContext/resources/environment/studio_UP.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_BK.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_DN.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_FR.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_LF.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_RT.jpg +0 -0
- OpenGLContext/resources/environment/studiobright_UP.jpg +0 -0
- OpenGLContext/resources/green_arrow_right_png.py +47 -0
- OpenGLContext/resources/legacy_lighting.vert.txt +37 -0
- OpenGLContext/resources/legacy_lighting_vert_txt.py +18 -0
- OpenGLContext/resources/lights.vert.txt +107 -0
- OpenGLContext/resources/lights_vert_txt.py +23 -0
- OpenGLContext/resources/phongprecalc_vert.py +30 -0
- OpenGLContext/resources/phongweights_frag.py +47 -0
- OpenGLContext/resources/pygame_icon_png.py +47 -0
- OpenGLContext/resources/red_arrow_right_png.py +50 -0
- OpenGLContext/resources/simpleshader.frag.txt +3 -0
- OpenGLContext/resources/simpleshader.vert.txt +3 -0
- OpenGLContext/resources/simpleshader_frag_txt.py +9 -0
- OpenGLContext/resources/simpleshader_vert_txt.py +10 -0
- OpenGLContext/scenegraph/__init__.py +19 -0
- OpenGLContext/scenegraph/appearance.py +107 -0
- OpenGLContext/scenegraph/arraygeometry.py +238 -0
- OpenGLContext/scenegraph/audio.py +632 -0
- OpenGLContext/scenegraph/background.py +108 -0
- OpenGLContext/scenegraph/basenodes.py +50 -0
- OpenGLContext/scenegraph/billboard.py +14 -0
- OpenGLContext/scenegraph/boundingvolume.py +494 -0
- OpenGLContext/scenegraph/box.py +180 -0
- OpenGLContext/scenegraph/collision.py +14 -0
- OpenGLContext/scenegraph/coordinate.py +20 -0
- OpenGLContext/scenegraph/coordinatebounded.py +18 -0
- OpenGLContext/scenegraph/cubebackground.py +207 -0
- OpenGLContext/scenegraph/extrusions.py +275 -0
- OpenGLContext/scenegraph/fog.py +123 -0
- OpenGLContext/scenegraph/gear.py +323 -0
- OpenGLContext/scenegraph/group.py +20 -0
- OpenGLContext/scenegraph/grouping.py +140 -0
- OpenGLContext/scenegraph/hdrbackground.py +384 -0
- OpenGLContext/scenegraph/ifscompiler.py +633 -0
- OpenGLContext/scenegraph/imagetexture.py +365 -0
- OpenGLContext/scenegraph/indexedfaceset.py +238 -0
- OpenGLContext/scenegraph/indexedlineset.py +418 -0
- OpenGLContext/scenegraph/indexedpolygons.py +422 -0
- OpenGLContext/scenegraph/inline.py +79 -0
- OpenGLContext/scenegraph/instancedgl.py +187 -0
- OpenGLContext/scenegraph/interpolators.py +122 -0
- OpenGLContext/scenegraph/light.py +213 -0
- OpenGLContext/scenegraph/lod.py +22 -0
- OpenGLContext/scenegraph/material.py +96 -0
- OpenGLContext/scenegraph/material_fields.py +50 -0
- OpenGLContext/scenegraph/mouseover.py +43 -0
- OpenGLContext/scenegraph/nodepath.py +52 -0
- OpenGLContext/scenegraph/nurbs.py +637 -0
- OpenGLContext/scenegraph/nurbssampling.py +101 -0
- OpenGLContext/scenegraph/nurbstess.py +316 -0
- OpenGLContext/scenegraph/nurbstrim.py +54 -0
- OpenGLContext/scenegraph/particles.py +786 -0
- OpenGLContext/scenegraph/pbrmaterial.py +229 -0
- OpenGLContext/scenegraph/pbrmesh.py +558 -0
- OpenGLContext/scenegraph/physicsbody.py +72 -0
- OpenGLContext/scenegraph/pointset.py +257 -0
- OpenGLContext/scenegraph/polygon.py +166 -0
- OpenGLContext/scenegraph/polygonsort.py +119 -0
- OpenGLContext/scenegraph/polygontessellator.py +213 -0
- OpenGLContext/scenegraph/quadrics.py +494 -0
- OpenGLContext/scenegraph/scenegraph.py +21 -0
- OpenGLContext/scenegraph/shadergeometry.py +403 -0
- OpenGLContext/scenegraph/shaders.py +812 -0
- OpenGLContext/scenegraph/shape.py +243 -0
- OpenGLContext/scenegraph/simplebackground.py +34 -0
- OpenGLContext/scenegraph/spherebackground.py +462 -0
- OpenGLContext/scenegraph/switch.py +75 -0
- OpenGLContext/scenegraph/teapot.py +439 -0
- OpenGLContext/scenegraph/teapot_nurbs.py +291 -0
- OpenGLContext/scenegraph/teapot_nurbs_data.py +384 -0
- OpenGLContext/scenegraph/terrain/__init__.py +12 -0
- OpenGLContext/scenegraph/terrain/heightfield.py +172 -0
- OpenGLContext/scenegraph/terrain/splat.py +224 -0
- OpenGLContext/scenegraph/tessellationlod.py +97 -0
- OpenGLContext/scenegraph/text/__init__.py +1 -0
- OpenGLContext/scenegraph/text/_toolsfont.py +200 -0
- OpenGLContext/scenegraph/text/font.py +452 -0
- OpenGLContext/scenegraph/text/fontprovider.py +193 -0
- OpenGLContext/scenegraph/text/fonts/__init__.py +75 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_10.py +133 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_12.py +158 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_14.py +176 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_16.py +204 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_18.py +222 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_20.py +244 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_24.py +294 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_28.py +339 -0
- OpenGLContext/scenegraph/text/fonts/font_atlas_32.py +390 -0
- OpenGLContext/scenegraph/text/fontstyle3d.py +62 -0
- OpenGLContext/scenegraph/text/glutfont.py +186 -0
- OpenGLContext/scenegraph/text/pygamefont.py +213 -0
- OpenGLContext/scenegraph/text/shaderfont.py +340 -0
- OpenGLContext/scenegraph/text/shadertext.py +433 -0
- OpenGLContext/scenegraph/text/text.py +75 -0
- OpenGLContext/scenegraph/text/toolsfont.py +819 -0
- OpenGLContext/scenegraph/text/ttfregistry.py +135 -0
- OpenGLContext/scenegraph/text/wglfont.py +228 -0
- OpenGLContext/scenegraph/text/wglfontprovider.py +37 -0
- OpenGLContext/scenegraph/text/wxfont.py +314 -0
- OpenGLContext/scenegraph/texturetransform.py +66 -0
- OpenGLContext/scenegraph/tilesterrain.py +95 -0
- OpenGLContext/scenegraph/timesensor.py +51 -0
- OpenGLContext/scenegraph/transform.py +180 -0
- OpenGLContext/scenegraph/vegetation/__init__.py +20 -0
- OpenGLContext/scenegraph/vegetation/base.py +96 -0
- OpenGLContext/scenegraph/vegetation/billboards.py +145 -0
- OpenGLContext/scenegraph/vegetation/clumps.py +260 -0
- OpenGLContext/scenegraph/vegetation/grid.py +112 -0
- OpenGLContext/scenegraph/vegetation/nearmesh.py +185 -0
- OpenGLContext/scenegraph/vertex.py +54 -0
- OpenGLContext/scenegraph/viewpoint.py +42 -0
- OpenGLContext/scenegraph/winding.py +49 -0
- OpenGLContext/shaders/_brdf_inc.glsl +124 -0
- OpenGLContext/shaders/_common_inc.glsl +24 -0
- OpenGLContext/shaders/_cubemap_inc.glsl +26 -0
- OpenGLContext/shaders/_lights_inc.glsl +32 -0
- OpenGLContext/shaders/_objectid_inc.glsl +14 -0
- OpenGLContext/shaders/_shadow_inc.glsl +254 -0
- OpenGLContext/shaders/_vrml97_lighting_inc.glsl +78 -0
- OpenGLContext/shaders/hdr_background.frag +32 -0
- OpenGLContext/shaders/hdr_background.vert +15 -0
- OpenGLContext/shaders/ibl_brdf.frag +78 -0
- OpenGLContext/shaders/ibl_env.frag +53 -0
- OpenGLContext/shaders/ibl_equirect.frag +19 -0
- OpenGLContext/shaders/ibl_fullscreen.vert +11 -0
- OpenGLContext/shaders/ibl_irradiance.frag +40 -0
- OpenGLContext/shaders/ibl_prefilter.frag +56 -0
- OpenGLContext/shaders/particle.frag +42 -0
- OpenGLContext/shaders/particle.vert +52 -0
- OpenGLContext/shaders/pbr.frag +906 -0
- OpenGLContext/shaders/pbr.vert +70 -0
- OpenGLContext/shaders/shadow_depth.frag +4 -0
- OpenGLContext/shaders/shadow_depth.vert +18 -0
- OpenGLContext/shaders/terrain_splat.frag +80 -0
- OpenGLContext/shaders/terrain_splat.vert +16 -0
- OpenGLContext/shaders/veg_billboard.frag +35 -0
- OpenGLContext/shaders/veg_billboard.vert +17 -0
- OpenGLContext/shaders/veg_clump.frag +27 -0
- OpenGLContext/shaders/veg_mesh.frag +26 -0
- OpenGLContext/shaders/veg_mesh.vert +17 -0
- OpenGLContext/shaders/vrml97_background.frag +17 -0
- OpenGLContext/shaders/vrml97_background.vert +24 -0
- OpenGLContext/shaders/vrml97_lighting.frag +111 -0
- OpenGLContext/shaders/vrml97_lighting.vert +50 -0
- OpenGLContext/shaders/vrml97_line.frag +23 -0
- OpenGLContext/shaders/vrml97_line.vert +24 -0
- OpenGLContext/shaders/vrml97_point.frag +36 -0
- OpenGLContext/shaders/vrml97_point.vert +21 -0
- OpenGLContext/shaders/vrml97_unlit.frag +59 -0
- OpenGLContext/shaders/vrml97_unlit.vert +18 -0
- OpenGLContext/shaders/vrml97_vertex_color.frag +85 -0
- OpenGLContext/shaders/vrml97_vertex_color.vert +34 -0
- OpenGLContext/stalltrace.py +637 -0
- OpenGLContext/testing/__init__.py +67 -0
- OpenGLContext/testing/display.py +30 -0
- OpenGLContext/testing/event_injector.py +564 -0
- OpenGLContext/testing/framebuffer_comparison.py +842 -0
- OpenGLContext/testing/gl_env.py +39 -0
- OpenGLContext/testing/paths.py +23 -0
- OpenGLContext/testing/process_exit.py +30 -0
- OpenGLContext/testing/report_generator.py +594 -0
- OpenGLContext/testing/subprocess_runner.py +411 -0
- OpenGLContext/testingcontext.py +36 -0
- OpenGLContext/tests/test_atlas.py +62 -0
- OpenGLContext/tests/test_configs.py +27 -0
- OpenGLContext/tests/test_polygonsort.py +45 -0
- OpenGLContext/tests/test_utilities.py +84 -0
- OpenGLContext/tests/test_viewplatform.py +39 -0
- OpenGLContext/texture.py +449 -0
- OpenGLContext/texturecache.py +37 -0
- OpenGLContext/triangleutilities.py +89 -0
- OpenGLContext/ui/__init__.py +39 -0
- OpenGLContext/ui/bindings.py +243 -0
- OpenGLContext/ui/console.py +339 -0
- OpenGLContext/ui/debugoverlay.py +519 -0
- OpenGLContext/ui/dialogs.py +124 -0
- OpenGLContext/ui/draw.py +617 -0
- OpenGLContext/ui/gallery.py +425 -0
- OpenGLContext/ui/generate.py +195 -0
- OpenGLContext/ui/geometry.py +88 -0
- OpenGLContext/ui/hudwidgets.py +1053 -0
- OpenGLContext/ui/layout.py +263 -0
- OpenGLContext/ui/metrics.py +218 -0
- OpenGLContext/ui/overlay.py +412 -0
- OpenGLContext/ui/panel.py +459 -0
- OpenGLContext/ui/pictures.py +261 -0
- OpenGLContext/ui/screen.py +177 -0
- OpenGLContext/ui/scroll.py +297 -0
- OpenGLContext/ui/session.py +329 -0
- OpenGLContext/ui/settings.py +273 -0
- OpenGLContext/ui/skin.py +330 -0
- OpenGLContext/ui/widgets.py +1199 -0
- OpenGLContext/userpaths.py +48 -0
- OpenGLContext/utilities.py +94 -0
- OpenGLContext/vectorutilities.py +101 -0
- OpenGLContext/viewer/__init__.py +60 -0
- OpenGLContext/viewer/adapters/__init__.py +150 -0
- OpenGLContext/viewer/adapters/base.py +157 -0
- OpenGLContext/viewer/adapters/gltf.py +31 -0
- OpenGLContext/viewer/adapters/obj.py +20 -0
- OpenGLContext/viewer/adapters/scenegraph.py +71 -0
- OpenGLContext/viewer/adapters/tiles.py +296 -0
- OpenGLContext/viewer/adapters/vrml.py +25 -0
- OpenGLContext/viewer/asyncscene.py +117 -0
- OpenGLContext/viewer/caption.py +126 -0
- OpenGLContext/viewer/capture.py +77 -0
- OpenGLContext/viewer/debug.py +78 -0
- OpenGLContext/viewer/environment.py +131 -0
- OpenGLContext/viewer/framing.py +111 -0
- OpenGLContext/viewer/library.py +235 -0
- OpenGLContext/viewer/menu.py +218 -0
- OpenGLContext/viewer/options.py +150 -0
- OpenGLContext/viewer/overlay.py +63 -0
- OpenGLContext/viewer/sceneviewer.py +1056 -0
- OpenGLContext/viewer/screens.py +172 -0
- OpenGLContext/viewer/source.py +56 -0
- OpenGLContext/visitor.py +68 -0
- OpenGLContext/vrmlcontext.py +72 -0
- OpenGLContext/wxcontext.py +424 -0
- OpenGLContext/wxinteractivecontext.py +25 -0
- OpenGLContext/wxtestingcontext.py +9 -0
- OpenGLContext/wxvrmlcontext.py +13 -0
- openglcontext-3.0.0a1.dist-info/METADATA +650 -0
- openglcontext-3.0.0a1.dist-info/RECORD +417 -0
- openglcontext-3.0.0a1.dist-info/WHEEL +5 -0
- openglcontext-3.0.0a1.dist-info/entry_points.txt +11 -0
- openglcontext-3.0.0a1.dist-info/licenses/license.txt +89 -0
- openglcontext-3.0.0a1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""What a player gets to decide about sound.
|
|
2
|
+
|
|
3
|
+
A declared node rather than loose fields on the
|
|
4
|
+
:class:`~OpenGLContext.contextdefinition.ContextDefinition`, for the same reason
|
|
5
|
+
the movement modes are: sound has more than one knob, they belong together, and
|
|
6
|
+
a node gets validation, defaults, serialisation and a generated settings page
|
|
7
|
+
from the field system rather than from a parallel layer.
|
|
8
|
+
|
|
9
|
+
**Whose volume is whose** is the distinction worth understanding here, because
|
|
10
|
+
getting it wrong makes a volume control appear not to work:
|
|
11
|
+
|
|
12
|
+
:attr:`AudioSettings.volume`
|
|
13
|
+
The **player's** volume -- what the slider on the settings screen moves, what
|
|
14
|
+
a volume key should write, and what is saved with the rest of the player's
|
|
15
|
+
settings. The engine reads it every frame, so moving it is heard at once.
|
|
16
|
+
:attr:`~omi_audio.engine.AudioEngine.master_gain`
|
|
17
|
+
The **application's** mix level -- how loud this scene was authored to be.
|
|
18
|
+
An application sets it once and the player never sees it.
|
|
19
|
+
|
|
20
|
+
The two multiply. Writing one over the other every frame -- which is the
|
|
21
|
+
tempting shortcut -- makes whichever loses last exactly one frame, and the
|
|
22
|
+
symptom is a volume key that prints a new number and changes nothing.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
from typing import Any
|
|
28
|
+
|
|
29
|
+
from vrml import field, node
|
|
30
|
+
|
|
31
|
+
from OpenGLContext import renderoptions
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class AudioSettings(node.Node):
|
|
35
|
+
"""Sound, as the player controls it."""
|
|
36
|
+
|
|
37
|
+
PROTO = 'AudioSettings'
|
|
38
|
+
|
|
39
|
+
#: Whether the scene's sounds are played at all. Off opens no device and
|
|
40
|
+
#: starts no audio thread, which is what a capture run, a benchmark or a
|
|
41
|
+
#: machine with no sound card wants. A scene with nothing audible in it
|
|
42
|
+
#: costs nothing either way; see :mod:`OpenGLContext.audio.scene`.
|
|
43
|
+
enabled = field.newField(
|
|
44
|
+
'enabled', 'SFBool', 1,
|
|
45
|
+
lambda: renderoptions.env_flag('OPENGLCONTEXT_AUDIO', True))
|
|
46
|
+
#: The player's volume: 0 silent, 1 as the application intended. Linear
|
|
47
|
+
#: rather than decibels because that is what ``KHR_audio_emitter`` gains
|
|
48
|
+
#: are, and mixing the two units in one chain is how a volume control ends
|
|
49
|
+
#: up feeling wrong at one end of its travel.
|
|
50
|
+
volume = field.newField(
|
|
51
|
+
'volume', 'SFFloat', 1,
|
|
52
|
+
lambda: renderoptions.env_number('OPENGLCONTEXT_AUDIO_VOLUME', 1.0))
|
|
53
|
+
#: How many sounds may play at once. Past the pool's size the least
|
|
54
|
+
#: important is dropped, so this is a quality setting as much as a budget:
|
|
55
|
+
#: a busy scene on a small pool loses its quietest sounds first.
|
|
56
|
+
voices = field.newField('voices', 'SFInt32', 1, 32)
|
|
57
|
+
|
|
58
|
+
#: How a generated settings page presents these; see
|
|
59
|
+
#: :mod:`OpenGLContext.ui.generate`.
|
|
60
|
+
UI_HINTS = {
|
|
61
|
+
'enabled': {'label': 'Sound'},
|
|
62
|
+
'volume': {'label': 'Volume', 'minimum': 0.0, 'maximum': 1.0,
|
|
63
|
+
'step': 0.05},
|
|
64
|
+
'voices': {'label': 'Simultaneous sounds', 'minimum': 4,
|
|
65
|
+
'maximum': 128, 'step': 4},
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#: The order a settings page shows them in.
|
|
69
|
+
FIELDS = ('enabled', 'volume', 'voices')
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def settings_for(context: Any) -> AudioSettings:
|
|
73
|
+
"""The audio settings of ``context``, defaulted if it declares none.
|
|
74
|
+
|
|
75
|
+
A context need not have a definition at all -- a bare test double often does
|
|
76
|
+
not -- and a scene with sound in it should still run when it does not.
|
|
77
|
+
"""
|
|
78
|
+
definition = getattr(context, 'contextDefinition', None)
|
|
79
|
+
settings = getattr(definition, 'audio', None)
|
|
80
|
+
if isinstance(settings, AudioSettings):
|
|
81
|
+
return settings
|
|
82
|
+
return AudioSettings()
|
|
File without changes
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
'''Choose Context class for use as default testing context
|
|
3
|
+
'''
|
|
4
|
+
from OpenGLContext import testingcontext
|
|
5
|
+
BaseContext = testingcontext.getInteractive()
|
|
6
|
+
from OpenGLContext.scenegraph.basenodes import *
|
|
7
|
+
from vrml.vrml97 import nodetypes
|
|
8
|
+
from OpenGLContext.events import mouseevents
|
|
9
|
+
from gettext import gettext as _
|
|
10
|
+
|
|
11
|
+
class ChoiceContext( BaseContext ):
|
|
12
|
+
currentChoice = 0
|
|
13
|
+
def loadChoices( self ):
|
|
14
|
+
"""See which contexts are available"""
|
|
15
|
+
choices = [
|
|
16
|
+
e.name for e in self.getContextTypes()
|
|
17
|
+
]
|
|
18
|
+
return list(enumerate(choices))
|
|
19
|
+
def nameForContextType( self, index ):
|
|
20
|
+
if index > -1:
|
|
21
|
+
return self.choices[index][1]
|
|
22
|
+
return -1,None
|
|
23
|
+
def setSavedText( self, index ):
|
|
24
|
+
self.savedChoice = self.currentChoice
|
|
25
|
+
self.savedText.string = [ _('Current: %s')%(
|
|
26
|
+
self.nameForContextType( self.savedChoice )
|
|
27
|
+
)]
|
|
28
|
+
return self.savedChoice
|
|
29
|
+
def OnInit( self ):
|
|
30
|
+
"""Setup callbacks and build geometry for rendering"""
|
|
31
|
+
self.choices = self.loadChoices()
|
|
32
|
+
print('Available Contexts', self.choices)
|
|
33
|
+
current = self.getDefaultContextType()
|
|
34
|
+
for i,name in self.choices:
|
|
35
|
+
if name == current:
|
|
36
|
+
self.currentChoice = self.savedChoice = i
|
|
37
|
+
fontStyle = FontStyle3D(
|
|
38
|
+
size = 1,
|
|
39
|
+
family = "SERIF",
|
|
40
|
+
justify = "CENTER",
|
|
41
|
+
renderBack = False,
|
|
42
|
+
renderSides = False,
|
|
43
|
+
)
|
|
44
|
+
navFontStyle = FontStyle3D(
|
|
45
|
+
size = 2,
|
|
46
|
+
family = "SANS",
|
|
47
|
+
justify = "CENTER",
|
|
48
|
+
renderBack = False,
|
|
49
|
+
renderSides = False,
|
|
50
|
+
)
|
|
51
|
+
backButton = Text(
|
|
52
|
+
string = _('<'),
|
|
53
|
+
fontStyle = navFontStyle,
|
|
54
|
+
)
|
|
55
|
+
forwardButton = Text(
|
|
56
|
+
string = _('>'),
|
|
57
|
+
fontStyle = navFontStyle,
|
|
58
|
+
)
|
|
59
|
+
saveButton = Text(
|
|
60
|
+
string = _('Save'),
|
|
61
|
+
fontStyle = fontStyle,
|
|
62
|
+
)
|
|
63
|
+
self.previousButton = MouseOver(
|
|
64
|
+
choice = [
|
|
65
|
+
Shape(
|
|
66
|
+
geometry = backButton,
|
|
67
|
+
appearance = Appearance(
|
|
68
|
+
material = Material( diffuseColor = (0,.5,0) ),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
Shape(
|
|
72
|
+
geometry = backButton,
|
|
73
|
+
appearance = Appearance(
|
|
74
|
+
material = Material( diffuseColor = (0,1,0) ),
|
|
75
|
+
),
|
|
76
|
+
),
|
|
77
|
+
],
|
|
78
|
+
whichChoice = 0,
|
|
79
|
+
)
|
|
80
|
+
clicker = Shape(
|
|
81
|
+
DEF = 'CLICKER',
|
|
82
|
+
geometry = Box( size=(1,1,.001)),
|
|
83
|
+
appearance = Appearance(
|
|
84
|
+
material = Material( transparency=0 ),
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
self.nextButton = MouseOver(
|
|
88
|
+
choice = [
|
|
89
|
+
Group(
|
|
90
|
+
children = [
|
|
91
|
+
Shape(
|
|
92
|
+
geometry = forwardButton,
|
|
93
|
+
appearance = Appearance(
|
|
94
|
+
material = Material( diffuseColor = (0,.5,0) ),
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
clicker,
|
|
98
|
+
],
|
|
99
|
+
),
|
|
100
|
+
Group(
|
|
101
|
+
children = [
|
|
102
|
+
Shape(
|
|
103
|
+
geometry = forwardButton,
|
|
104
|
+
appearance = Appearance(
|
|
105
|
+
material = Material( diffuseColor = (1,1,0) ),
|
|
106
|
+
),
|
|
107
|
+
),
|
|
108
|
+
#clicker,
|
|
109
|
+
],
|
|
110
|
+
),
|
|
111
|
+
],
|
|
112
|
+
whichChoice = 0,
|
|
113
|
+
)
|
|
114
|
+
self.saveButton = MouseOver(
|
|
115
|
+
choice = [
|
|
116
|
+
Shape(
|
|
117
|
+
geometry = saveButton,
|
|
118
|
+
appearance = Appearance(
|
|
119
|
+
material = Material( diffuseColor = (0,.5,0) ),
|
|
120
|
+
),
|
|
121
|
+
),
|
|
122
|
+
Shape(
|
|
123
|
+
geometry = saveButton,
|
|
124
|
+
appearance = Appearance(
|
|
125
|
+
material = Material( diffuseColor = (0,1,0) ),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
],
|
|
129
|
+
whichChoice = 0,
|
|
130
|
+
)
|
|
131
|
+
self.currentChoiceText = Text(
|
|
132
|
+
string=[self.choices[self.currentChoice][1]],
|
|
133
|
+
fontStyle = fontStyle,
|
|
134
|
+
)
|
|
135
|
+
self.savedText = Text(
|
|
136
|
+
string='',
|
|
137
|
+
fontStyle = fontStyle,
|
|
138
|
+
)
|
|
139
|
+
self.setSavedText( self.currentChoice )
|
|
140
|
+
|
|
141
|
+
self.sg = sceneGraph(
|
|
142
|
+
children = [
|
|
143
|
+
SimpleBackground( color = (0,0,.25) ),
|
|
144
|
+
Transform(
|
|
145
|
+
translation = (0,2,0),
|
|
146
|
+
children = [
|
|
147
|
+
Shape(
|
|
148
|
+
geometry = self.currentChoiceText,
|
|
149
|
+
),
|
|
150
|
+
],
|
|
151
|
+
),
|
|
152
|
+
Transform(
|
|
153
|
+
translation = (-4,-1.5,0),
|
|
154
|
+
children = [
|
|
155
|
+
self.previousButton,
|
|
156
|
+
],
|
|
157
|
+
),
|
|
158
|
+
Transform(
|
|
159
|
+
translation = (4,-1.5,0),
|
|
160
|
+
children = [
|
|
161
|
+
self.nextButton,
|
|
162
|
+
],
|
|
163
|
+
),
|
|
164
|
+
Transform(
|
|
165
|
+
translation= (0,-1,0),
|
|
166
|
+
children = [self.saveButton],
|
|
167
|
+
),
|
|
168
|
+
Transform(
|
|
169
|
+
translation= (0,-3,0),
|
|
170
|
+
children = [
|
|
171
|
+
Shape(
|
|
172
|
+
geometry = self.savedText,
|
|
173
|
+
),
|
|
174
|
+
],
|
|
175
|
+
),
|
|
176
|
+
],
|
|
177
|
+
)
|
|
178
|
+
# self.addEventHandler(
|
|
179
|
+
# 'mousebutton',
|
|
180
|
+
# node=self.previousButton,
|
|
181
|
+
# button = 0,
|
|
182
|
+
# state = 0,
|
|
183
|
+
# function = self.OnPrevious,
|
|
184
|
+
# )
|
|
185
|
+
# self.addEventHandler(
|
|
186
|
+
# 'mousebutton',
|
|
187
|
+
# node=self.nextButton,
|
|
188
|
+
# button = 0,
|
|
189
|
+
# state = 0,
|
|
190
|
+
# function = self.OnNext,
|
|
191
|
+
# )
|
|
192
|
+
# self.addEventHandler(
|
|
193
|
+
# 'mousebutton',
|
|
194
|
+
# node=self.saveButton,
|
|
195
|
+
# button = 0,
|
|
196
|
+
# state = 0,
|
|
197
|
+
# function = self.OnSave,
|
|
198
|
+
# )
|
|
199
|
+
|
|
200
|
+
def OnNext( self, event ):
|
|
201
|
+
"""Clicked the next button"""
|
|
202
|
+
self.currentChoice += 1
|
|
203
|
+
self.currentChoice = self.currentChoice % len( self.choices )
|
|
204
|
+
self.currentChoiceText.string = self.choices[self.currentChoice][1]
|
|
205
|
+
self.triggerRedraw(1)
|
|
206
|
+
def OnPrevious( self, event ):
|
|
207
|
+
"""Clicked the previous button"""
|
|
208
|
+
self.currentChoice -= 1
|
|
209
|
+
self.currentChoice = self.currentChoice % len( self.choices )
|
|
210
|
+
self.currentChoiceText.string = self.choices[self.currentChoice][1]
|
|
211
|
+
self.triggerRedraw(1)
|
|
212
|
+
|
|
213
|
+
def OnSave( self, event ):
|
|
214
|
+
"""Save current choice to the preferences file"""
|
|
215
|
+
self.setDefaultContextType( self.choices[self.currentChoice][1] )
|
|
216
|
+
self.setSavedText( self.currentChoice )
|
|
217
|
+
self.triggerRedraw(1)
|
|
218
|
+
|
|
219
|
+
def main():
|
|
220
|
+
"""Mainloop redirecting to context's mainloop for operations"""
|
|
221
|
+
return ChoiceContext.ContextMainLoop()
|
|
222
|
+
|
|
223
|
+
if __name__ == "__main__":
|
|
224
|
+
main()
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
"""Test of text objects"""
|
|
3
|
+
|
|
4
|
+
from OpenGLContext import testingcontext
|
|
5
|
+
|
|
6
|
+
BaseContext = testingcontext.getInteractive()
|
|
7
|
+
from OpenGL.GL import *
|
|
8
|
+
from OpenGLContext.arrays import *
|
|
9
|
+
import logging
|
|
10
|
+
|
|
11
|
+
log = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
from OpenGLContext.scenegraph.basenodes import *
|
|
14
|
+
from OpenGLContext.scenegraph.text import fontprovider
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestContext(BaseContext):
|
|
18
|
+
currentStyle = -1
|
|
19
|
+
|
|
20
|
+
def Render(self, mode=0):
|
|
21
|
+
BaseContext.Render(self, mode)
|
|
22
|
+
for shape in self.shapes:
|
|
23
|
+
mode.visit(shape)
|
|
24
|
+
|
|
25
|
+
def setupFontProviders(self):
|
|
26
|
+
"""Load font providers for the context
|
|
27
|
+
|
|
28
|
+
See the OpenGLContext.scenegraph.text package for the
|
|
29
|
+
available font providers.
|
|
30
|
+
"""
|
|
31
|
+
from OpenGLContext.scenegraph.text import fontprovider
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
from OpenGLContext.scenegraph.text import toolsfont
|
|
35
|
+
|
|
36
|
+
assert toolsfont
|
|
37
|
+
registry = self.getTTFFiles()
|
|
38
|
+
except ImportError:
|
|
39
|
+
log.warning(
|
|
40
|
+
"""Unable to import fonttools-based TTF-file registry, no TTF font support!"""
|
|
41
|
+
)
|
|
42
|
+
else:
|
|
43
|
+
fontprovider.setTTFRegistry(
|
|
44
|
+
registry,
|
|
45
|
+
)
|
|
46
|
+
self.families = registry.DEFAULT_FAMILY_SETS.keys()
|
|
47
|
+
self.families.sort()
|
|
48
|
+
self.family = self.families[0]
|
|
49
|
+
try:
|
|
50
|
+
from OpenGLContext.scenegraph.text import pygamefont
|
|
51
|
+
|
|
52
|
+
assert pygamefont
|
|
53
|
+
except ImportError:
|
|
54
|
+
log.warning(
|
|
55
|
+
"""Unable to import PyGame TTF-font renderer, no PyGame anti-aliased font support!"""
|
|
56
|
+
)
|
|
57
|
+
try:
|
|
58
|
+
from OpenGLContext.scenegraph.text import glutfont
|
|
59
|
+
|
|
60
|
+
assert glutfont
|
|
61
|
+
except ImportError:
|
|
62
|
+
log.warning(
|
|
63
|
+
"""Unable to import GLUT-based TTF-file registry, no GLUT bitmap font support!"""
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
def OnInit(self):
|
|
67
|
+
print("""You should see a 3D-rendered text message""")
|
|
68
|
+
print(" <p> previous fontstyle")
|
|
69
|
+
print(" <n> next fontstyle")
|
|
70
|
+
print(" <f> next font-family")
|
|
71
|
+
print(" <d> set current font as default font for family")
|
|
72
|
+
self.addEventHandler("keypress", name="n", function=self.OnNextStyle)
|
|
73
|
+
self.addEventHandler("keypress", name="p", function=self.OnPreviousStyle)
|
|
74
|
+
self.addEventHandler("keypress", name="d", function=self.OnSetDefault)
|
|
75
|
+
self.addEventHandler("keypress", name="f", function=self.OnNextFamily)
|
|
76
|
+
self.currentDefault = FontStyle(
|
|
77
|
+
justify="MIDDLE",
|
|
78
|
+
family=[self.family],
|
|
79
|
+
)
|
|
80
|
+
self.currentDisplay = FontStyle(
|
|
81
|
+
justify="MIDDLE",
|
|
82
|
+
)
|
|
83
|
+
self.defaultText = Text(
|
|
84
|
+
string=["Current Default"],
|
|
85
|
+
fontStyle=self.currentDefault,
|
|
86
|
+
)
|
|
87
|
+
self.displayText = Text(
|
|
88
|
+
string=["Hello World!", "VRML97 Text"],
|
|
89
|
+
fontStyle=self.currentDisplay,
|
|
90
|
+
)
|
|
91
|
+
self.sg = sceneGraph(
|
|
92
|
+
children=[
|
|
93
|
+
Transform(
|
|
94
|
+
translation=(0, 3, 0),
|
|
95
|
+
children=[
|
|
96
|
+
Shape(
|
|
97
|
+
geometry=self.defaultText,
|
|
98
|
+
appearance=Appearance(
|
|
99
|
+
material=Material(
|
|
100
|
+
diffuseColor=(0.3, 0.2, 0.8),
|
|
101
|
+
shininess=0.1,
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
],
|
|
106
|
+
),
|
|
107
|
+
Shape(
|
|
108
|
+
geometry=self.displayText,
|
|
109
|
+
appearance=Appearance(
|
|
110
|
+
material=Material(
|
|
111
|
+
diffuseColor=(0.3, 0.2, 0.8),
|
|
112
|
+
shininess=0.1,
|
|
113
|
+
),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
]
|
|
117
|
+
)
|
|
118
|
+
self.buildStyles()
|
|
119
|
+
|
|
120
|
+
def buildStyles(self):
|
|
121
|
+
"""Build the set of styles from which to choose"""
|
|
122
|
+
try:
|
|
123
|
+
self.styles = self.getTTFFiles().familyMembers(self.family)
|
|
124
|
+
except ImportError:
|
|
125
|
+
self.styles = ["SERIF", "SANS", "TYPEWRITER"]
|
|
126
|
+
if self.styles:
|
|
127
|
+
self.currentDefaultName = (
|
|
128
|
+
self.getDefaultTTFFont(self.family) or self.styles[0]
|
|
129
|
+
)
|
|
130
|
+
self.defaultDisplayText()
|
|
131
|
+
if self.currentDefaultName in self.styles:
|
|
132
|
+
index = self.styles.index(self.currentDefaultName)
|
|
133
|
+
else:
|
|
134
|
+
index = 0
|
|
135
|
+
self.setStyle(index)
|
|
136
|
+
|
|
137
|
+
def setStyle(self, index=0):
|
|
138
|
+
"""Set the current font style"""
|
|
139
|
+
if self.styles:
|
|
140
|
+
self.currentStyle = index % (len(self.styles))
|
|
141
|
+
name = self.styles[self.currentStyle]
|
|
142
|
+
self.currentDisplay.family = [
|
|
143
|
+
name,
|
|
144
|
+
]
|
|
145
|
+
# self.sg.children[1].geometry.fontStyle = self.currentDisplay
|
|
146
|
+
# print 'node', repr(self.sg.children[1].geometry)
|
|
147
|
+
assert not self.cache.getData(
|
|
148
|
+
self.sg.children[1].geometry
|
|
149
|
+
), """Cache wasn't cleared for the text node"""
|
|
150
|
+
self.mainDisplayText()
|
|
151
|
+
|
|
152
|
+
def OnPreviousStyle(self, event=None):
|
|
153
|
+
"""Advance to the next font font style"""
|
|
154
|
+
self.currentStyle -= 1
|
|
155
|
+
if not self.currentStyle % 20:
|
|
156
|
+
providers = fontprovider.FontProvider.getProviders(self.currentStyle)
|
|
157
|
+
for provider in providers:
|
|
158
|
+
provider.clear()
|
|
159
|
+
self.setStyle(self.currentStyle)
|
|
160
|
+
self.triggerRedraw(1)
|
|
161
|
+
|
|
162
|
+
def OnNextStyle(self, event=None):
|
|
163
|
+
"""Advance to the next font font style"""
|
|
164
|
+
self.currentStyle += 1
|
|
165
|
+
if not self.currentStyle % 20:
|
|
166
|
+
providers = fontprovider.FontProvider.getProviders(self.currentStyle)
|
|
167
|
+
for provider in providers:
|
|
168
|
+
provider.clear()
|
|
169
|
+
self.setStyle(self.currentStyle)
|
|
170
|
+
self.triggerRedraw(1)
|
|
171
|
+
|
|
172
|
+
def OnSetDefault(self, event=None):
|
|
173
|
+
"""Set default font for OpenGLContext to currently displayed"""
|
|
174
|
+
if self.styles:
|
|
175
|
+
name = self.currentDisplay.family[0]
|
|
176
|
+
self.setDefaultTTFFont(name, type=self.family)
|
|
177
|
+
self.currentDefaultName = name
|
|
178
|
+
self.defaultDisplayText()
|
|
179
|
+
self.triggerRedraw(1)
|
|
180
|
+
|
|
181
|
+
def OnNextFamily(self, event=None):
|
|
182
|
+
"""Choose the next font-family to display"""
|
|
183
|
+
index = self.families.index(self.family)
|
|
184
|
+
index += 1
|
|
185
|
+
index = index % len(self.families)
|
|
186
|
+
self.family = self.families[index]
|
|
187
|
+
self.buildStyles()
|
|
188
|
+
|
|
189
|
+
self.triggerRedraw(1)
|
|
190
|
+
|
|
191
|
+
def mainDisplayText(self):
|
|
192
|
+
"""Decide on what text to display in the main text area"""
|
|
193
|
+
base = []
|
|
194
|
+
if self.styles:
|
|
195
|
+
base.append("Hello World!")
|
|
196
|
+
base.append(self.styles[self.currentStyle])
|
|
197
|
+
base.append("(%s)" % (self.family))
|
|
198
|
+
else:
|
|
199
|
+
base.extend(["No", repr(self.family), "fonts available"])
|
|
200
|
+
self.displayText.string = base
|
|
201
|
+
return base
|
|
202
|
+
|
|
203
|
+
def defaultDisplayText(self):
|
|
204
|
+
self.currentDefault.family = [self.currentDefaultName]
|
|
205
|
+
self.defaultText.string = ["Current Default", self.currentDefaultName]
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
if __name__ == "__main__":
|
|
209
|
+
TestContext.ContextMainLoop()
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
"""Automated test runner for OpenGLContext contexts"""
|
|
3
|
+
|
|
4
|
+
import optparse, sys, os, logging
|
|
5
|
+
try:
|
|
6
|
+
import configparser as ConfigParser
|
|
7
|
+
except ImportError:
|
|
8
|
+
import ConfigParser
|
|
9
|
+
|
|
10
|
+
log = logging.getLogger("gltest")
|
|
11
|
+
from OpenGLContext import testingcontext, context, plugins
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
"""Do the test for the passed elements"""
|
|
16
|
+
parser = optparse.OptionParser()
|
|
17
|
+
parser.add_option(
|
|
18
|
+
"-c",
|
|
19
|
+
"--config",
|
|
20
|
+
action="append",
|
|
21
|
+
type="string",
|
|
22
|
+
dest="configs",
|
|
23
|
+
default=None,
|
|
24
|
+
)
|
|
25
|
+
parser.add_option(
|
|
26
|
+
"-s",
|
|
27
|
+
"--script",
|
|
28
|
+
action="store",
|
|
29
|
+
type="string",
|
|
30
|
+
dest="script",
|
|
31
|
+
default=None,
|
|
32
|
+
)
|
|
33
|
+
parser.add_option(
|
|
34
|
+
"-o",
|
|
35
|
+
"--output",
|
|
36
|
+
action="store",
|
|
37
|
+
type="string",
|
|
38
|
+
dest="output",
|
|
39
|
+
default="test-results",
|
|
40
|
+
)
|
|
41
|
+
parser.add_option(
|
|
42
|
+
"-f",
|
|
43
|
+
"--frame-count",
|
|
44
|
+
action="store",
|
|
45
|
+
type="int",
|
|
46
|
+
dest="frame_count",
|
|
47
|
+
default=3,
|
|
48
|
+
)
|
|
49
|
+
options, args = parser.parse_args(sys.argv[1:])
|
|
50
|
+
if not options.script:
|
|
51
|
+
if args:
|
|
52
|
+
options.script = args[0]
|
|
53
|
+
script = os.path.abspath(options.script)
|
|
54
|
+
log.info("Script: %s", script)
|
|
55
|
+
if not os.path.exists(script):
|
|
56
|
+
log.error("""Couldn't find script file: %s""", script)
|
|
57
|
+
script_name = os.path.splitext(os.path.basename(script))[0]
|
|
58
|
+
|
|
59
|
+
ref_name = os.path.join(options.output, "%(script_name)s-ref.png" % locals())
|
|
60
|
+
if not os.path.exists(ref_name):
|
|
61
|
+
output_name = ref_name
|
|
62
|
+
log.warning("Recording reference image for %s", script_name)
|
|
63
|
+
else:
|
|
64
|
+
output_name = os.path.join(options.output, "%(script)s-new.png")
|
|
65
|
+
|
|
66
|
+
if options.configs:
|
|
67
|
+
configs = [c for c in options.configs if c]
|
|
68
|
+
else:
|
|
69
|
+
configs = []
|
|
70
|
+
if configs:
|
|
71
|
+
cfg = ConfigParser.ConfigParser()
|
|
72
|
+
cfg.read(*configs)
|
|
73
|
+
cls = context.Context.fromConfig(cfg)
|
|
74
|
+
else:
|
|
75
|
+
cls = context.Context.getContextType("pygame", plugins.VRMLContext)
|
|
76
|
+
if cls is None:
|
|
77
|
+
cls = context.Context.getContextType(None, plugins.VRMLContext)
|
|
78
|
+
|
|
79
|
+
class SaveAndExit(cls):
|
|
80
|
+
"""Context which exits after the Nth rendering pass"""
|
|
81
|
+
|
|
82
|
+
target_frame_count = options.frame_count
|
|
83
|
+
frame_count = 0
|
|
84
|
+
|
|
85
|
+
def setupFrameRateCounter(self):
|
|
86
|
+
"""Don't want the frame-rate counter to mess up the diffs"""
|
|
87
|
+
|
|
88
|
+
def OnDraw(self, *args, **named):
|
|
89
|
+
super(SaveAndExit, self).OnDraw(*args, **named)
|
|
90
|
+
self.frame_count += 1
|
|
91
|
+
if self.frame_count > self.target_frame_count:
|
|
92
|
+
self.setCurrent()
|
|
93
|
+
width, height = self.OnSaveImage(
|
|
94
|
+
template=output_name,
|
|
95
|
+
script=script_name,
|
|
96
|
+
overwrite=True,
|
|
97
|
+
)
|
|
98
|
+
self.unsetCurrent()
|
|
99
|
+
if (not width) or (not height):
|
|
100
|
+
log.warning("Did not write retrying")
|
|
101
|
+
sys.exit(0)
|
|
102
|
+
os._exit(0)
|
|
103
|
+
self.triggerRedraw()
|
|
104
|
+
|
|
105
|
+
testingcontext.CONFIGURED_BASE = SaveAndExit
|
|
106
|
+
# now, execute the script...
|
|
107
|
+
try:
|
|
108
|
+
os.makedirs(options.output)
|
|
109
|
+
except (IOError, OSError) as err:
|
|
110
|
+
pass
|
|
111
|
+
sys.path.insert(0, os.path.dirname(script))
|
|
112
|
+
g = {}
|
|
113
|
+
g["__name__"] = "__main__"
|
|
114
|
+
g["__file__"] = script
|
|
115
|
+
with open(script, 'rb') as f:
|
|
116
|
+
exec(compile(f.read(), script, 'exec'), g)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
logging.basicConfig(level=logging.INFO)
|
|
121
|
+
main()
|