ogre-python 14.6.3__cp312-cp312-macosx_15_0_arm64.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.
Files changed (100) hide show
  1. Ogre/Bites.py +14 -0
  2. Ogre/Bullet.py +14 -0
  3. Ogre/HighPy.py +409 -0
  4. Ogre/ImGui.py +12 -0
  5. Ogre/Numpy.py +80 -0
  6. Ogre/OGRE/Codec_Assimp.14.6.dylib +0 -0
  7. Ogre/OGRE/Codec_Assimp.dylib +0 -0
  8. Ogre/OGRE/Codec_STBI.14.6.dylib +0 -0
  9. Ogre/OGRE/Codec_STBI.dylib +0 -0
  10. Ogre/OGRE/Plugin_DotScene.14.6.dylib +0 -0
  11. Ogre/OGRE/Plugin_DotScene.dylib +0 -0
  12. Ogre/OGRE/Plugin_OctreeSceneManager.14.6.dylib +0 -0
  13. Ogre/OGRE/Plugin_OctreeSceneManager.dylib +0 -0
  14. Ogre/OGRE/Plugin_ParticleFX.14.6.dylib +0 -0
  15. Ogre/OGRE/Plugin_ParticleFX.dylib +0 -0
  16. Ogre/OGRE/RenderSystem_GL.14.6.dylib +0 -0
  17. Ogre/OGRE/RenderSystem_GL.dylib +0 -0
  18. Ogre/OGRE/RenderSystem_GL3Plus.14.6.dylib +0 -0
  19. Ogre/OGRE/RenderSystem_GL3Plus.dylib +0 -0
  20. Ogre/OGRE/RenderSystem_Tiny.14.6.dylib +0 -0
  21. Ogre/OGRE/RenderSystem_Tiny.dylib +0 -0
  22. Ogre/Ogre.py +12 -0
  23. Ogre/Overlay.py +14 -0
  24. Ogre/RTShader.py +14 -0
  25. Ogre/Terrain.py +14 -0
  26. Ogre/_Bites.so +0 -0
  27. Ogre/_Bullet.so +0 -0
  28. Ogre/_ImGui.so +0 -0
  29. Ogre/_Ogre.so +0 -0
  30. Ogre/_Overlay.so +0 -0
  31. Ogre/_RTShader.so +0 -0
  32. Ogre/_Terrain.so +0 -0
  33. Ogre/__init__.py +2 -0
  34. Ogre/libOgreBites.14.6.dylib +0 -0
  35. Ogre/libOgreBites.dylib +0 -0
  36. Ogre/libOgreBullet.dylib +0 -0
  37. Ogre/libOgreMain.14.6.dylib +0 -0
  38. Ogre/libOgreMain.dylib +0 -0
  39. Ogre/libOgreOverlay.14.6.dylib +0 -0
  40. Ogre/libOgreOverlay.dylib +0 -0
  41. Ogre/libOgrePaging.14.6.dylib +0 -0
  42. Ogre/libOgrePaging.dylib +0 -0
  43. Ogre/libOgreRTShaderSystem.14.6.dylib +0 -0
  44. Ogre/libOgreRTShaderSystem.dylib +0 -0
  45. Ogre/libOgreTerrain.14.6.dylib +0 -0
  46. Ogre/libOgreTerrain.dylib +0 -0
  47. Ogre/libSDL2-2.0.0.dylib +0 -0
  48. Ogre/libSDL2-2.0.dylib +0 -0
  49. Ogre/libSDL2.dylib +0 -0
  50. Ogre/libz.1.3.2.dylib +0 -0
  51. Ogre/libz.1.dylib +0 -0
  52. Ogre/libz.dylib +0 -0
  53. ogre_python-14.6.3.data/data/Media/Main/DefaultShaders.metal +38 -0
  54. ogre_python-14.6.3.data/data/Media/Main/GLSL_GL3Support.glsl +110 -0
  55. ogre_python-14.6.3.data/data/Media/Main/HLSL_SM4Support.hlsl +124 -0
  56. ogre_python-14.6.3.data/data/Media/Main/OgreGizmos.material +41 -0
  57. ogre_python-14.6.3.data/data/Media/Main/OgreUnifiedShader.h +205 -0
  58. ogre_python-14.6.3.data/data/Media/Main/Shadow.material +91 -0
  59. ogre_python-14.6.3.data/data/Media/Main/ShadowBlend.frag +11 -0
  60. ogre_python-14.6.3.data/data/Media/Main/ShadowBlend.vert +12 -0
  61. ogre_python-14.6.3.data/data/Media/Main/ShadowExtrudeDirLight.vert +18 -0
  62. ogre_python-14.6.3.data/data/Media/Main/ShadowExtrudeDirLightFinite.vert +22 -0
  63. ogre_python-14.6.3.data/data/Media/Main/ShadowExtrudePointLight.vert +19 -0
  64. ogre_python-14.6.3.data/data/Media/Main/ShadowExtrudePointLightFinite.vert +22 -0
  65. ogre_python-14.6.3.data/data/Media/Main/ShadowVolumeExtude.program +41 -0
  66. ogre_python-14.6.3.data/data/Media/Main/spot_shadow_fade.dds +0 -0
  67. ogre_python-14.6.3.data/data/Media/RTShaderLib/FFPLib_AlphaTest.glsl +45 -0
  68. ogre_python-14.6.3.data/data/Media/RTShaderLib/FFPLib_Fog.glsl +92 -0
  69. ogre_python-14.6.3.data/data/Media/RTShaderLib/FFPLib_Texturing.glsl +150 -0
  70. ogre_python-14.6.3.data/data/Media/RTShaderLib/FFPLib_Transform.glsl +100 -0
  71. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSLib_Colour.glsl +16 -0
  72. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSLib_Froxels.glsl +101 -0
  73. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSLib_IBL.glsl +91 -0
  74. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSLib_LTC.glsl +114 -0
  75. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSLib_Lighting.glsl +30 -0
  76. ogre_python-14.6.3.data/data/Media/RTShaderLib/RTSSamplers.material +18 -0
  77. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_CookTorrance.glsl +250 -0
  78. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_DualQuaternion.glsl +172 -0
  79. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_IntegratedPSSM.glsl +197 -0
  80. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_LayeredBlending.glsl +825 -0
  81. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_NormalMap.glsl +125 -0
  82. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_PerPixelLighting.glsl +219 -0
  83. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_TriplanarTexturing.glsl +47 -0
  84. ogre_python-14.6.3.data/data/Media/RTShaderLib/SGXLib_WBOIT.glsl +19 -0
  85. ogre_python-14.6.3.data/data/Media/RTShaderLib/dfgLUTmultiscatter.dds +0 -0
  86. ogre_python-14.6.3.data/data/Media/RTShaderLib/ltc_1.dds +0 -0
  87. ogre_python-14.6.3.data/data/Media/RTShaderLib/ltc_2.dds +0 -0
  88. ogre_python-14.6.3.data/data/Media/Terrain/TerrainSurface.glsl +91 -0
  89. ogre_python-14.6.3.data/data/Media/Terrain/TerrainTransforms.glsl +36 -0
  90. ogre_python-14.6.3.data/data/Media/packs/SdkTrays.zip +0 -0
  91. ogre_python-14.6.3.data/data/Media/packs/profiler.zip +0 -0
  92. ogre_python-14.6.3.data/data/bin/plugins.cfg +27 -0
  93. ogre_python-14.6.3.data/data/bin/resources.cfg +12 -0
  94. ogre_python-14.6.3.data/data/bin/sdl2-config +65 -0
  95. ogre_python-14.6.3.dist-info/METADATA +167 -0
  96. ogre_python-14.6.3.dist-info/RECORD +100 -0
  97. ogre_python-14.6.3.dist-info/WHEEL +5 -0
  98. ogre_python-14.6.3.dist-info/licenses/AUTHORS +313 -0
  99. ogre_python-14.6.3.dist-info/licenses/LICENSE +21 -0
  100. ogre_python-14.6.3.dist-info/top_level.txt +1 -0
Ogre/Bites.py ADDED
@@ -0,0 +1,14 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ import Ogre.Ogre
9
+
10
+ # Pull in all the attributes from the low-level C/C++ module
11
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
12
+ from ._Bites import *
13
+ else:
14
+ from _Bites import *
Ogre/Bullet.py ADDED
@@ -0,0 +1,14 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ import Ogre.Ogre
9
+
10
+ # Pull in all the attributes from the low-level C/C++ module
11
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
12
+ from ._Bullet import *
13
+ else:
14
+ from _Bullet import *
Ogre/HighPy.py ADDED
@@ -0,0 +1,409 @@
1
+ # This file is part of the OGRE project.
2
+ # It is subject to the license terms in the LICENSE file found in the top-level directory
3
+ # of this distribution and at https://www.ogre3d.org/licensing.
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ import os
7
+ import math
8
+ import struct
9
+
10
+ from typing import Union
11
+
12
+ import Ogre
13
+ import Ogre.Bites
14
+ import Ogre.RTShader
15
+ import Ogre.Overlay
16
+
17
+ ## \cond PRIVATE
18
+
19
+ class _InputListener(Ogre.Bites.InputListener):
20
+ def __init__(self, window_data):
21
+ Ogre.Bites.InputListener.__init__(self)
22
+ self.window_data = window_data
23
+
24
+ def keyPressed(self, evt):
25
+ self.window_data.last_key = evt.keysym.sym
26
+ return True
27
+
28
+ class _ImGuiDispatcher(Ogre.RenderTargetListener):
29
+ def __init__(self, callback):
30
+ Ogre.RenderTargetListener.__init__(self)
31
+ self.callback = callback
32
+
33
+ def preRenderTargetUpdate(self, _):
34
+ Ogre.Overlay.ImGuiOverlay.NewFrame()
35
+ self.callback()
36
+
37
+ class _WindowData:
38
+ def __init__(self, window):
39
+ self.window = window.render
40
+ self.camera = None
41
+ self.scn_mgr = None
42
+ self.background = None
43
+ self.last_key = 0
44
+
45
+ self._input_listener = None
46
+ self._native = window.native
47
+
48
+ def listen_to_input(self):
49
+ assert self._input_listener is None
50
+ self._input_listener = _InputListener(self)
51
+ _ctx.addInputListener(self._native, self._input_listener)
52
+
53
+ class _Application(Ogre.Bites.ApplicationContext):
54
+ def __init__(self):
55
+ # warnings and errors only
56
+ if not os.environ.get("OGRE_MIN_LOGLEVEL"):
57
+ os.environ["OGRE_MIN_LOGLEVEL"] = "3"
58
+
59
+ Ogre.Bites.ApplicationContext.__init__(self, "OgreHighPy")
60
+
61
+ self.name = None
62
+ self.imsize = None
63
+ self.imgui_dispatcher = None
64
+
65
+ self.windows = {}
66
+
67
+ self.createRoot()
68
+
69
+ def createWindow(self, name, w, h, *_args):
70
+ if not self.windows:
71
+ name = self.name
72
+ w, h = self.imsize
73
+
74
+ misc = Ogre.NameValueMap()
75
+ ret = Ogre.Bites.ApplicationContext.createWindow(self, name, w, h, misc)
76
+ self.windows[name] = _WindowData(ret)
77
+ return ret
78
+
79
+ def createRoot(self):
80
+ if self.getRoot():
81
+ return
82
+ Ogre.Bites.ApplicationContext.createRoot(self)
83
+
84
+ rgm = Ogre.ResourceGroupManager.getSingleton()
85
+ assert isinstance(user_resource_locations, set)
86
+ if not user_resource_locations:
87
+ rgm.addResourceLocation(".", "FileSystem", Ogre.RGN_DEFAULT, True)
88
+
89
+ for loc in user_resource_locations:
90
+ rgm.addResourceLocation(str(loc), "FileSystem", Ogre.RGN_DEFAULT)
91
+
92
+ def oneTimeConfig(self):
93
+ self.getRoot().restoreConfig()
94
+ rs = self.getRoot().getRenderSystemByName("OpenGL 3+ Rendering Subsystem")
95
+ self.getRoot().setRenderSystem(rs)
96
+ self.getRoot().saveConfig()
97
+ return True
98
+
99
+ def _create_image_background(scn_mgr, name):
100
+ tex = Ogre.TextureManager.getSingleton().create(name, Ogre.RGN_DEFAULT, True)
101
+ tex.setNumMipmaps(0)
102
+
103
+ mat = Ogre.MaterialManager.getSingleton().create(name, Ogre.RGN_DEFAULT)
104
+ mat.getTechnique(0).getPass(0).createTextureUnitState().setTexture(tex)
105
+ mat.getTechnique(0).getPass(0).setDepthWriteEnabled(False)
106
+ mat.getTechnique(0).getPass(0).setLightingEnabled(False)
107
+
108
+ rect = scn_mgr.createScreenSpaceRect(True)
109
+ rect.setMaterial(mat)
110
+ rect.setRenderQueueGroup(Ogre.RENDER_QUEUE_BACKGROUND)
111
+ scn_mgr.getRootSceneNode().attachObject(rect)
112
+
113
+ return tex
114
+
115
+ _ctx = None
116
+
117
+ def _init_ogre(window_name, imsize):
118
+ global _ctx
119
+
120
+ _ctx = _Application()
121
+ _ctx.name = window_name
122
+ _ctx.imsize = imsize
123
+ _ctx.initApp()
124
+
125
+ def _init_window(window_data, flags):
126
+ scn_mgr = _ctx.getRoot().createSceneManager()
127
+ window_data.scn_mgr = scn_mgr
128
+ Ogre.RTShader.ShaderGenerator.getSingleton().addSceneManager(scn_mgr)
129
+
130
+ window_data.camera = scn_mgr.createCamera("camera")
131
+ window_data.camera.setAutoAspectRatio(True)
132
+
133
+ camnode = scn_mgr.getRootSceneNode().createChildSceneNode()
134
+ camnode.attachObject(window_data.camera)
135
+ if flags & AXES_ZFORWARD_YDOWN:
136
+ # convert from AXES_ZBACKWARD_YUP (Ogre default)
137
+ camnode.setOrientation(Ogre.Quaternion(Ogre.Math.PI, (1, 0, 0)))
138
+ window_data.window.addViewport(window_data.camera)
139
+
140
+ window_data.listen_to_input()
141
+
142
+ ## \endcond
143
+
144
+ ## \addtogroup Optional
145
+ # @{
146
+ # \addtogroup Python
147
+ # @{
148
+
149
+
150
+ ## %Ogre & OpenGL coordinate system
151
+ AXES_ZBACKWARD_YUP = 0
152
+ ## OpenCV & colmap coordinate system
153
+ AXES_ZFORWARD_YDOWN = 1
154
+
155
+ ## add paths here to override the default resource location @c "."
156
+ user_resource_locations = set()
157
+
158
+ def window_create(window_name: str, window_size, flags: int = AXES_ZBACKWARD_YUP):
159
+ """!
160
+ create a window
161
+ @param window_name: name of the window
162
+ @param window_size: size of the window in pixels
163
+ @param flags: window create options
164
+ """
165
+ if _ctx is None:
166
+ _init_ogre(window_name, window_size)
167
+ else:
168
+ _ctx.createWindow(window_name, *window_size)
169
+
170
+ _init_window(_ctx.windows[window_name], flags)
171
+
172
+ def window_draw(window_name: str) -> int:
173
+ """!
174
+ draw the window
175
+ @param window_name: name of the window
176
+ @return last key pressed inside the window
177
+ """
178
+ assert _ctx is not None, "call window_create first"
179
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
180
+ _ctx.pollEvents()
181
+
182
+ window_data = _ctx.windows[window_name]
183
+ window_data.window.update()
184
+ ret = window_data.last_key
185
+ window_data.last_key = 0
186
+ return ret
187
+
188
+ def window_use_imgui(window_name: str, callback):
189
+ """!
190
+ enable imgui for the window
191
+ @param window_name: name of the window
192
+ @param callback: function to call for imgui rendering
193
+ """
194
+ assert _ctx is not None, "call window_create first"
195
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
196
+ assert _ctx.imgui_dispatcher is None, "imgui already enabled. Only one window can have imgui enabled at a time."
197
+
198
+ _ctx.imgui_dispatcher = _ImGuiDispatcher(callback)
199
+
200
+ overlay = _ctx.initialiseImGui()
201
+ window_data = _ctx.windows[window_name]
202
+ window_data.scn_mgr.addRenderQueueListener(_ctx.getOverlaySystem())
203
+ window_data.window.addListener(_ctx.imgui_dispatcher)
204
+ overlay.show()
205
+ _ctx.addInputListener(_ctx.getImGuiInputListener())
206
+
207
+ def window_compositor(window_name: str, compositor_name: str):
208
+ """!
209
+ set a compositor for the window
210
+ @param window_name: name of the window
211
+ @param compositor_name: name of the compositor
212
+ """
213
+ assert _ctx is not None, "call window_create first"
214
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
215
+
216
+ window_data = _ctx.windows[window_name]
217
+
218
+ cm = Ogre.CompositorManager.getSingleton()
219
+ vp = window_data.window.getViewport(0)
220
+
221
+ cm.addCompositor(vp, compositor_name)
222
+ cm.setCompositorEnabled(vp, compositor_name, True)
223
+
224
+ def window_pixel_data(window_name: str, compositor_name: str | None = None, texture_name: str | None = None, mrt_index: int = 0):
225
+ """!
226
+ get the pixel data from the window or the active compositor
227
+ @param window_name: name of the window
228
+ @param compositor_name: name of the compositor
229
+ @param texture_name: name of the texture
230
+ @param mrt_index: index of the MRT
231
+ @return: pixel data as a memoryview
232
+ """
233
+ assert _ctx is not None, "call window_create first"
234
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
235
+
236
+ window_data = _ctx.windows[window_name]
237
+ rtarget = window_data.window
238
+ dst_type = Ogre.PF_BYTE_RGB
239
+
240
+ if compositor_name:
241
+ cm = Ogre.CompositorManager.getSingleton()
242
+ chain = cm.getCompositorChain(rtarget.getViewport(0))
243
+ assert chain, "no active compositors"
244
+ inst = chain.getCompositor(compositor_name)
245
+ assert inst, f"no compositor named: {compositor_name}"
246
+ tex = inst.getTextureInstance(texture_name, mrt_index)
247
+ assert tex, f"no texture named: {texture_name}"
248
+
249
+ dst_type = tex.getFormat()
250
+ rtarget = tex.getBuffer().getRenderTarget()
251
+
252
+ dtype = 'B'
253
+ if dst_type == Ogre.PF_BYTE_RGB:
254
+ shape = (rtarget.getHeight(), rtarget.getWidth(), 3)
255
+ elif dst_type == Ogre.PF_BYTE_RGBA:
256
+ shape = (rtarget.getHeight(), rtarget.getWidth(), 4)
257
+ elif dst_type == Ogre.PF_L16 or dst_type == Ogre.PF_DEPTH16:
258
+ shape = (rtarget.getHeight(), rtarget.getWidth(), 1)
259
+ dtype = 'H'
260
+ elif dst_type == Ogre.PF_FLOAT32_R or dst_type == Ogre.PF_DEPTH32F:
261
+ shape = (rtarget.getHeight(), rtarget.getWidth(), 1)
262
+ dtype = 'f'
263
+ else:
264
+ raise ValueError(f"unsupported format: {Ogre.PixelUtil.getFormatName(dst_type)}")
265
+
266
+ buf = bytearray(math.prod(shape) * struct.calcsize(dtype))
267
+ mview = memoryview(buf).cast(dtype, shape)
268
+ pb = Ogre.PixelBox(mview)
269
+ rtarget.copyContentsToMemory(pb, pb)
270
+
271
+ return mview
272
+
273
+ def imshow(window_name: str, img_src: Union[str, os.PathLike, memoryview, "np.ndarray"]):
274
+ """!
275
+ show an image in the window
276
+ @param window_name: name of the window
277
+ @param img_src: image data or path to the image file
278
+ """
279
+ assert _ctx is not None, "call window_create first"
280
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
281
+
282
+ window_data = _ctx.windows[window_name]
283
+ if window_data.background is None:
284
+ window_data.background = _create_image_background(_ctx.windows[window_name].scn_mgr, window_name)
285
+
286
+ img = Ogre.Image()
287
+
288
+ if hasattr(img_src, "shape"):
289
+ img.loadDynamicImage(img_src)
290
+ else: # load from file
291
+ img.load(str(img_src), Ogre.RGN_DEFAULT)
292
+
293
+ window_data.background.loadImage(img)
294
+
295
+ def imwrite(filename, imgdata: Union[memoryview, "np.ndarray"]):
296
+ """!
297
+ Save an image to a file.
298
+ @param filename: The name of the file to save the image to.
299
+ @param imgdata: The pixel data of the image. Should be a memoryview or numpy array
300
+ """
301
+ im = Ogre.Image()
302
+ im.loadDynamicImage(imgdata)
303
+ im.save(filename)
304
+
305
+ def camera_intrinsics(window_name: str, K, imsize):
306
+ """!
307
+ set camera intrinsics
308
+ @param window_name: name of the window
309
+ @param K: 3x3 camera matrix
310
+ @param imsize: image size in pixels
311
+ """
312
+ assert _ctx is not None, "call window_create first"
313
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
314
+
315
+ cam = _ctx.windows[window_name].camera
316
+ cam.setAspectRatio(imsize[0]/imsize[1])
317
+
318
+ zNear = cam.getNearClipDistance()
319
+ top = zNear * K[1][2] / K[1][1]
320
+ left = -zNear * K[0][2] / K[0][0]
321
+ right = zNear * (imsize[0] - K[0][2]) / K[0][0]
322
+ bottom = -zNear * (imsize[1] - K[1][2]) / K[1][1]
323
+
324
+ cam.setFrustumExtents(left, right, top, bottom)
325
+
326
+ fovy = math.atan2(K[1][2], K[1][1]) + math.atan2(imsize[1] - K[1][2], K[1][1])
327
+ cam.setFOVy(fovy)
328
+
329
+ def mesh_show(window_name: str, mesh_path: str | os.PathLike, rot_mat = None, position = (0, 0, 0), material_name: str | None = None, entity_name: str | None = None):
330
+ """!
331
+ show a mesh in the window
332
+ @param window_name: name of the window
333
+ @param mesh_path: path to the mesh file
334
+ @param rot_mat: 3x3 rotation matrix
335
+ @param position: 3x1 translation vector
336
+ @param material_name: optional material name to use instead of the default
337
+ @param entity_name: optional entity name to allow multiple instances of the same mesh
338
+ """
339
+ assert _ctx is not None, "call window_create first"
340
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
341
+
342
+ mesh_path = str(mesh_path)
343
+ scn_mgr = _ctx.windows[window_name].scn_mgr
344
+
345
+ if entity_name is None:
346
+ entity_name = mesh_path
347
+
348
+ if scn_mgr.hasEntity(entity_name):
349
+ ent = scn_mgr.getEntity(entity_name)
350
+ else:
351
+ ent = scn_mgr.createEntity(entity_name, mesh_path, Ogre.RGN_DEFAULT)
352
+ scn_mgr.getRootSceneNode().createChildSceneNode().attachObject(ent)
353
+
354
+ if material_name:
355
+ ent.setMaterialName(material_name, Ogre.RGN_DEFAULT)
356
+
357
+ scn_node = ent.getParentSceneNode()
358
+ ent.setVisible(True)
359
+
360
+ scn_node._update(True, False)
361
+ diam = scn_node._getWorldAABB().getSize().length()
362
+
363
+ cam = _ctx.windows[window_name].camera
364
+ cam.setNearClipDistance(min(cam.getNearClipDistance(), diam*0.01))
365
+
366
+ if rot_mat is not None:
367
+ flat = [v for row in rot_mat for v in row]
368
+ rot_mat = Ogre.Matrix3(*flat)
369
+ scn_node.setOrientation(Ogre.Quaternion(rot_mat))
370
+
371
+ scn_node.setPosition(position)
372
+
373
+ def mesh_hide(window_name: str, mesh_path: str | os.PathLike):
374
+ """!
375
+ hide a mesh in the window
376
+ @param window_name: name of the window
377
+ @param mesh_path: path to the mesh file
378
+ """
379
+ assert _ctx is not None, "call window_create first"
380
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
381
+
382
+ scn_mgr = _ctx.windows[window_name].scn_mgr
383
+ mesh_path = str(mesh_path)
384
+ # hiding non-existent mesh has no effect
385
+ if scn_mgr.hasEntity(mesh_path):
386
+ ent = scn_mgr.getEntity(mesh_path)
387
+ ent.setVisible(False)
388
+
389
+ def point_light(window_name: str, position = (0, 0, 0)):
390
+ """!
391
+ create a point light in the window
392
+ @param window_name: name of the window
393
+ @param position: position of the light in world coordinates
394
+ """
395
+ assert _ctx is not None, "call window_create first"
396
+ assert window_name in _ctx.windows, f"no window named: {window_name}"
397
+
398
+ scn_mgr = _ctx.windows[window_name].scn_mgr
399
+ if scn_mgr.hasLight("point_light"):
400
+ light_node = _ctx.scn_mgr.getLight("point_light").getParentSceneNode()
401
+ else:
402
+ light = scn_mgr.createLight("point_light", Ogre.Light.LT_POINT)
403
+ light_node = scn_mgr.getRootSceneNode().createChildSceneNode()
404
+ light_node.attachObject(light)
405
+
406
+ light_node.setPosition(*position)
407
+
408
+ ## @}
409
+ ## @}
Ogre/ImGui.py ADDED
@@ -0,0 +1,12 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ # Pull in all the attributes from the low-level C/C++ module
9
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
10
+ from ._ImGui import *
11
+ else:
12
+ from _ImGui import *
Ogre/Numpy.py ADDED
@@ -0,0 +1,80 @@
1
+ # This file is part of the OGRE project.
2
+ # It is subject to the license terms in the LICENSE file found in the top-level directory
3
+ # of this distribution and at https://www.ogre3d.org/licensing.
4
+ # SPDX-License-Identifier: MIT
5
+
6
+ import Ogre
7
+
8
+ import ctypes
9
+ import numpy.ctypeslib as npc
10
+ import numpy as np
11
+
12
+ ## \addtogroup Optional
13
+ # @{
14
+ # \defgroup Python Python
15
+ # Convenience functions for python
16
+ # @{
17
+
18
+ def AsDataStream(arr):
19
+ """!
20
+ copy numpy array to Ogre.MemoryDataStream that can be used in Ogre
21
+ @param arr: some numpy array
22
+ """
23
+ size = int(np.prod(arr.shape) * arr.dtype.itemsize)
24
+ ret = Ogre.MemoryDataStream(size)
25
+ tp = ctypes.POINTER(ctypes.c_ubyte)
26
+ np_view = npc.as_array(ctypes.cast(int(ret.getPtr()), tp), (size, ))
27
+ np_view[:] = arr.ravel().view(np.ubyte)
28
+
29
+ return ret
30
+
31
+ def view(o):
32
+ """!
33
+ writable numpy view to the ogre data types
34
+
35
+ take care that the ogre type does not get released while the view is used.
36
+ e.g. this is invalid
37
+
38
+ ```py
39
+ v = Ogre.Vector3()
40
+ return Ogre.Numpy.view(v)
41
+ ```
42
+
43
+ instead do
44
+ ```py
45
+ return Ogre.Numpy.view(v).copy()
46
+ ```
47
+
48
+ to pass numpy arrays into Ogre use AsDataStream()
49
+ """
50
+ tp = ctypes.POINTER(ctypes.c_float)
51
+
52
+ if isinstance(o, Ogre.Vector2):
53
+ shape = (2,)
54
+ ptr = o.this
55
+ elif isinstance(o, Ogre.Vector3):
56
+ shape = (3,)
57
+ ptr = o.this
58
+ elif isinstance(o, Ogre.Vector4):
59
+ shape = (4,)
60
+ ptr = o.this
61
+ elif isinstance(o, Ogre.Matrix3):
62
+ shape = (3, 3)
63
+ ptr = o.this
64
+ elif isinstance(o, Ogre.Affine3):
65
+ shape = (3, 4)
66
+ ptr = o.this
67
+ elif isinstance(o, Ogre.Matrix4):
68
+ shape = (4, 4)
69
+ ptr = o.this
70
+ elif isinstance(o, Ogre.PixelBox):
71
+ tp = ctypes.POINTER(ctypes.c_uint8)
72
+ shape = (o.getHeight(), o.getWidth(), Ogre.PixelUtil.getNumElemBytes(o.format))
73
+ ptr = o.data
74
+ else:
75
+ raise TypeError("do not know how to map '{}'".format(type(o).__name__))
76
+
77
+ return npc.as_array(ctypes.cast(int(ptr), tp), shape)
78
+
79
+ ## @}
80
+ ## @}
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Ogre/Ogre.py ADDED
@@ -0,0 +1,12 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ # Pull in all the attributes from the low-level C/C++ module
9
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
10
+ from ._Ogre import *
11
+ else:
12
+ from _Ogre import *
Ogre/Overlay.py ADDED
@@ -0,0 +1,14 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ import Ogre.Ogre
9
+
10
+ # Pull in all the attributes from the low-level C/C++ module
11
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
12
+ from ._Overlay import *
13
+ else:
14
+ from _Overlay import *
Ogre/RTShader.py ADDED
@@ -0,0 +1,14 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ import Ogre.Ogre
9
+
10
+ # Pull in all the attributes from the low-level C/C++ module
11
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
12
+ from ._RTShader import *
13
+ else:
14
+ from _RTShader import *
Ogre/Terrain.py ADDED
@@ -0,0 +1,14 @@
1
+ # This file was automatically generated by SWIG (https://www.swig.org).
2
+ # Version 4.5.1
3
+ #
4
+ # Do not make changes to this file unless you know what you are doing - modify
5
+ # the SWIG interface file instead.
6
+
7
+ import typing
8
+ import Ogre.Ogre
9
+
10
+ # Pull in all the attributes from the low-level C/C++ module
11
+ if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
12
+ from ._Terrain import *
13
+ else:
14
+ from _Terrain import *
Ogre/_Bites.so ADDED
Binary file
Ogre/_Bullet.so ADDED
Binary file
Ogre/_ImGui.so ADDED
Binary file
Ogre/_Ogre.so ADDED
Binary file
Ogre/_Overlay.so ADDED
Binary file
Ogre/_RTShader.so ADDED
Binary file
Ogre/_Terrain.so ADDED
Binary file
Ogre/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ from Ogre.Ogre import *
2
+ from Ogre.Ogre import __version__
Binary file
Binary file
Binary file
Binary file
Ogre/libOgreMain.dylib ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file