Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releasing 1.3.0 #51

Merged
merged 31 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c305c14
Bump version to 1.3.0
kamarianakis Oct 22, 2023
3555aec
Fix error when clicking and the ImGUIecssDecorator was not set as the…
kamarianakis Oct 23, 2023
7985d7c
Use atexit for VertexArray deletion
kamarianakis Oct 23, 2023
5638f2f
Properly declare the ECSSManager Singleton creation
kamarianakis Oct 23, 2023
ce88ed0
Make sure all tests are running
kamarianakis Oct 23, 2023
e703530
Modify widgets to initially open collapsed
kamarianakis Oct 23, 2023
8d9f2e6
Change Texture default behaviour from GL_MIRRORED_REPEAT to gl.GL_REPEAT
kamarianakis Oct 27, 2023
4043148
Add more texture files
kamarianakis Oct 27, 2023
755bc4a
Add a simple vertex shader that uses a single mvp matrix
kamarianakis Oct 27, 2023
d64667b
Fix typo
kamarianakis Oct 30, 2023
29b9b84
Make ECSS Graph closable, Add menu bar to reopen it
kamarianakis Oct 30, 2023
606cf80
Make sure ESC closes the window after changes to ECSS graph
kamarianakis Oct 30, 2023
454a08a
Add open3d to setup
kamarianakis Nov 2, 2023
e14d8bc
Throw a warning that GUI may not move camera
kamarianakis Nov 3, 2023
f9819fc
Make sure that Collapse Windows works properly
kamarianakis Nov 6, 2023
f20432f
Add description text in plotting feature
kamarianakis Nov 6, 2023
6e46fbb
Add description text in rigid body animation feature
kamarianakis Nov 6, 2023
c2d4c36
Add description to the slicing feature
kamarianakis Nov 6, 2023
f687495
Add description to Voronoi feature
kamarianakis Nov 6, 2023
a9aeab9
Use displayGUI_text from Shortcuts everywhere
kamarianakis Nov 6, 2023
663709c
Fix paths in Skinning Notebook
kamarianakis Nov 6, 2023
5c3a88b
Rename example of skinned mesh
kamarianakis Nov 6, 2023
2b5fb25
Retouch example 3 description
kamarianakis Nov 13, 2023
437a98d
Retouch example 4 description
kamarianakis Nov 13, 2023
11d5be1
Retouch example 6 and enable ECSS Graph
kamarianakis Nov 13, 2023
9a62925
Clean example 6, show ECSS Graph
kamarianakis Nov 13, 2023
ddc269c
Clean example 8
kamarianakis Nov 13, 2023
e1ad9fc
Retouch example 9
kamarianakis Nov 13, 2023
15a390c
Retouch example 10
kamarianakis Nov 13, 2023
5463ce3
Retouch example 12
kamarianakis Nov 13, 2023
23d09a7
Add pyassimp as prerequisite
kamarianakis Nov 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Elements/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module
__version__ = '1.2.1'
__version__ = '1.3.0'
2 changes: 1 addition & 1 deletion Elements/examples/1.Introductory/example_3_cube_lookAt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from Elements.utils.Shortcuts import displayGUI_text
example_description = \
"This is a scene with some simple geometry, i.e., a colored cube. \n\
The cube and axes are rendered with a simple shader. \n\
The cube is rendered via the simplest vertex and fragment shader. \n\
You cannot move the camera through the GUI. Hit ESC OR Close the window to quit."

winWidth = 1024
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
example_description = \
"This is a scene with a cube, a terrain and axes. \n\
The cube and axes are rendered with a simple shader. \n\
You move the camera through the GUI or the camera. Hit ESC OR Close the window to quit."
that allow camera movement too, via the Elements GUI. \n\n\
An ECSS Graph shows the Entities and Components of the \n\
scene, in read only way, i.e., you cannot manipulate \n\
any information via the ECSS Graph GUI. \n\n\
You can move the camera through the Elements GUI \n\
or the mouse. Hit ESC OR Close the window to quit."

winWidth = 1024
winHeight = 768
Expand Down
30 changes: 10 additions & 20 deletions Elements/examples/1.Introductory/example_6_import_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
The scene is being lit using the Blinn-Phong algorithm. \n\
You may move the camera using the mouse or the GUI. \n\
You may see the ECS Scenegraph showing Entities & Components of the scene and \n\
various information about them. Hit ESC OR Close the window to quit."
various information about them (read-only). Hit ESC OR Close the window to quit."

#Light
Lposition = util.vec(2.0, 5.5, 2.0) #uniform lightpos
Expand Down Expand Up @@ -58,14 +58,6 @@
# projMat = util.perspective(90.0, 1.33, 0.1, 100)
projMat = util.perspective(50.0, 1.0, 1.0, 10.0)

m = np.linalg.inv(projMat @ view)


entityCam2 = scene.world.createEntity(Entity(name="Entity_Camera"))
scene.world.addEntityChild(entityCam1, entityCam2)
trans2 = scene.world.addComponent(entityCam2, BasicTransform(name="Camera_TRS", trs=util.identity()))
# orthoCam = scene.world.addComponent(entityCam2, Camera(util.ortho(-100.0, 100.0, -100.0, 100.0, 1.0, 100.0), "orthoCam","Camera","500"))
orthoCam = scene.world.addComponent(entityCam2, Camera(m, "orthoCam","Camera","500"))

node4 = scene.world.createEntity(Entity(name="Object"))
scene.world.addEntityChild(rootEntity, node4)
Expand Down Expand Up @@ -111,7 +103,6 @@

# Systems
transUpdate = scene.world.createSystem(TransformSystem("transUpdate", "TransformSystem", "001"))
camUpdate = scene.world.createSystem(CameraSystem("camUpdate", "CameraUpdate", "200"))
renderUpdate = scene.world.createSystem(RenderGLShaderSystem())
initUpdate = scene.world.createSystem(InitGLShaderSystem())

Expand Down Expand Up @@ -172,7 +163,7 @@
# MAIN RENDERING LOOP

running = True
scene.init(imgui=True, windowWidth = winWidth, windowHeight = winHeight, windowTitle = "Elements: Tea anyone?", openGLversion = 4)
scene.init(imgui=True, windowWidth = winWidth, windowHeight = winHeight, windowTitle = "Elements: Tea anyone?", openGLversion = 4, customImGUIdecorator=ImGUIecssDecorator)

# pre-pass scenegraph to initialise all GL context dependent geometry, shader classes
# needs an active GL context
Expand Down Expand Up @@ -204,26 +195,24 @@
gWindow._myCamera = view # otherwise, an imgui slider must be moved to properly update

model_terrain_axes = util.translate(0.0,0.0,0.0)
model_cube = util.scale(0.1) @ util.translate(0.0,0.5,0.0)
model_teapot = util.scale(0.1) @ util.translate(0.0,0.5,0.0)



while running:
running = scene.render()
displayGUI_text(example_description)
scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.world.traverse_visit_pre_camera(camUpdate, orthoCam)
scene.world.traverse_visit(camUpdate, scene.world.root)
scene.world.traverse_visit(transUpdate, scene.world.root)
view = gWindow._myCamera # updates view via the imgui
#mvp_cube = projMat @ view @ model_cube
mvp_object = projMat @ view @ trans4.trs
mvp_terrain = projMat @ view @ terrain_trans.trs
mvp_axes = projMat @ view @ axes_trans.trs

mvp_object = projMat @ view @ trans4.l2world
mvp_terrain = projMat @ view @ terrain_trans.l2world
mvp_axes = projMat @ view @ axes_trans.l2world
axes_shader.setUniformVariable(key='modelViewProj', value=mvp_axes, mat4=True)
terrain_shader.setUniformVariable(key='modelViewProj', value=mvp_terrain, mat4=True)

shaderDec4.setUniformVariable(key='modelViewProj', value=mvp_object, mat4=True)
shaderDec4.setUniformVariable(key='model',value=model_cube,mat4=True)
shaderDec4.setUniformVariable(key='model',value=trans4.l2world,mat4=True)
shaderDec4.setUniformVariable(key='ambientColor',value=Lambientcolor,float3=True)
shaderDec4.setUniformVariable(key='ambientStr',value=Lambientstr,float1=True)
shaderDec4.setUniformVariable(key='viewPos',value=LviewPos,float3=True)
Expand All @@ -234,6 +223,7 @@
shaderDec4.setUniformVariable(key='matColor',value=Mcolor,float3=True)


scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.render_post()

scene.shutdown()
Expand Down
27 changes: 7 additions & 20 deletions Elements/examples/2.Intermediate/example_10_cube_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,20 @@

winWidth = 1024
winHeight = 768
scene = Scene()

# Scenegraph with Entities, Components
rootEntity = scene.world.createEntity(Entity(name="RooT"))
entityCam1 = scene.world.createEntity(Entity(name="entityCam1"))
scene.world.addEntityChild(rootEntity, entityCam1)
trans1 = scene.world.addComponent(entityCam1, BasicTransform(name="trans1", trs=util.identity()))

eye = util.vec(1, 0.54, 1.0)
target = util.vec(0.02, 0.14, 0.217)
up = util.vec(0.0, 1.0, 0.0)
view = util.lookat(eye, target, up)
projMat = util.perspective(50.0, 1.0, 1.0, 10.0)
m = np.linalg.inv(projMat @ view)

entityCam2 = scene.world.createEntity(Entity(name="entityCam2"))
scene.world.addEntityChild(entityCam1, entityCam2)
trans2 = scene.world.addComponent(entityCam2, BasicTransform(name="trans2", trs=util.identity()))
# orthoCam = scene.world.addComponent(entityCam2, Camera(util.ortho(-100.0, 100.0, -100.0, 100.0, 1.0, 100.0), "orthoCam","Camera","500"))
orthoCam = scene.world.addComponent(entityCam2, Camera(m, "orthoCam","Camera","500"))
# Scenegraph with Entities, Components
scene = Scene()
rootEntity = scene.world.createEntity(Entity(name="RooT"))

skybox = scene.world.createEntity(Entity(name="Skybox"))
scene.world.addEntityChild(rootEntity, skybox)
transSkybox = scene.world.addComponent(skybox, BasicTransform(name="transSkybox", trs=util.identity)) #util.identity()
transSkybox = scene.world.addComponent(skybox, BasicTransform(name="transSkybox", trs=util.identity())) #util.identity()
meshSkybox = scene.world.addComponent(skybox, RenderMesh(name="meshSkybox"))

node4 = scene.world.createEntity(Entity(name="node4"))
Expand Down Expand Up @@ -102,7 +92,6 @@

# Systems
transUpdate = scene.world.createSystem(TransformSystem("transUpdate", "TransformSystem", "001"))
camUpdate = scene.world.createSystem(CameraSystem("camUpdate", "CameraUpdate", "200"))
renderUpdate = scene.world.createSystem(RenderGLShaderSystem())
initUpdate = scene.world.createSystem(InitGLShaderSystem())

Expand Down Expand Up @@ -172,24 +161,22 @@
shaderSkybox.setUniformVariable(key='cubemap', value=face_data, texture3D=True)
shaderDec4.setUniformVariable(key='cubemap', value=face_data_2, texture3D=True)

model_cube = util.translate(0.0,0.5,0.0)

while running:
running = scene.render()
displayGUI_text(example_description)
scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.world.traverse_visit_pre_camera(camUpdate, orthoCam)
scene.world.traverse_visit(camUpdate, scene.world.root)
scene.world.traverse_visit(transUpdate, scene.world.root)

view = gWindow._myCamera # updates view via the imgui

shaderDec4.setUniformVariable(key='Proj', value=projMat, mat4=True)
shaderDec4.setUniformVariable(key='View', value=view, mat4=True)
shaderDec4.setUniformVariable(key='model', value=model_cube, mat4=True)
shaderDec4.setUniformVariable(key='model', value=trans4.l2world, mat4=True)

shaderSkybox.setUniformVariable(key='Proj', value=projMat, mat4=True)
shaderSkybox.setUniformVariable(key='View', value=view, mat4=True)

scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.render_post()

scene.shutdown()
28 changes: 6 additions & 22 deletions Elements/examples/2.Intermediate/example_8_textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,19 @@

# Scenegraph with Entities, Components
rootEntity = scene.world.createEntity(Entity(name="RooT"))
entityCam1 = scene.world.createEntity(Entity(name="entityCam1"))
scene.world.addEntityChild(rootEntity, entityCam1)
trans1 = scene.world.addComponent(entityCam1, BasicTransform(name="trans1", trs=util.identity()))

eye = util.vec(1, 0.54, 1.0)
target = util.vec(0.02, 0.14, 0.217)
up = util.vec(0.0, 1.0, 0.0)
view = util.lookat(eye, target, up)
projMat = util.perspective(50.0, 1.0, 1.0, 10.0)
m = np.linalg.inv(projMat @ view)

entityCam2 = scene.world.createEntity(Entity(name="entityCam2"))
scene.world.addEntityChild(entityCam1, entityCam2)
trans2 = scene.world.addComponent(entityCam2, BasicTransform(name="trans2", trs=util.identity()))
# orthoCam = scene.world.addComponent(entityCam2, Camera(util.ortho(-100.0, 100.0, -100.0, 100.0, 1.0, 100.0), "orthoCam","Camera","500"))
orthoCam = scene.world.addComponent(entityCam2, Camera(m, "orthoCam","Camera","500"))

node4 = scene.world.createEntity(Entity(name="node4"))
scene.world.addEntityChild(rootEntity, node4)
trans4 = scene.world.addComponent(node4, BasicTransform(name="trans4", trs=util.translate(0,0.5,0))) #util.identity()
mesh4 = scene.world.addComponent(node4, RenderMesh(name="mesh4"))


axes = scene.world.createEntity(Entity(name="axes"))
scene.world.addEntityChild(rootEntity, axes)
axes_trans = scene.world.addComponent(axes, BasicTransform(name="axes_trans", trs=util.identity()))
axes_mesh = scene.world.addComponent(axes, RenderMesh(name="axes_mesh"))

# a simple triangle
vertexData = np.array([
[0.0, 0.0, 0.0, 1.0],
Expand Down Expand Up @@ -116,7 +101,6 @@

# Systems
transUpdate = scene.world.createSystem(TransformSystem("transUpdate", "TransformSystem", "001"))
camUpdate = scene.world.createSystem(CameraSystem("camUpdate", "CameraUpdate", "200"))
renderUpdate = scene.world.createSystem(RenderGLShaderSystem())
initUpdate = scene.world.createSystem(InitGLShaderSystem())

Expand Down Expand Up @@ -214,14 +198,14 @@
running = scene.render()
displayGUI_text(example_description)
scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.world.traverse_visit_pre_camera(camUpdate, orthoCam)
scene.world.traverse_visit(camUpdate, scene.world.root)
scene.world.traverse_visit(transUpdate, scene.world.root)

view = gWindow._myCamera # updates view via the imgui
mvp_terrain_axes = projMat @ view @ model_terrain_axes

axes_shader.setUniformVariable(key='modelViewProj', value=mvp_terrain_axes, mat4=True)
terrain_shader.setUniformVariable(key='modelViewProj', value=mvp_terrain_axes, mat4=True)
mvp_terrain = projMat @ view @ terrain_trans.l2world
mvp_axes = projMat @ view @ axes_trans.l2world
model_cube = trans4.l2world
axes_shader.setUniformVariable(key='modelViewProj', value=mvp_axes, mat4=True)
terrain_shader.setUniformVariable(key='modelViewProj', value=mvp_terrain, mat4=True)
shaderDec4.setUniformVariable(key='model', value=model_cube, mat4=True)
shaderDec4.setUniformVariable(key='View', value=view, mat4=True)
shaderDec4.setUniformVariable(key='Proj', value=projMat, mat4=True)
Expand Down
39 changes: 13 additions & 26 deletions Elements/examples/2.Intermediate/example_9_textures_with_lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
various information about them. Hit ESC OR Close the window to quit."

#Light
Lposition = util.vec(2.0, 5.5, 2.0) #uniform lightpos
Lposition = util.vec(5.0, 2.0, 2.0) #uniform lightpos
Lambientcolor = util.vec(1.0, 1.0, 1.0) #uniform ambient color
Lambientstr = 0.3 #uniform ambientStr
Lambientstr = 0.2 #uniform ambientStr
LviewPos = util.vec(2.5, 2.8, 5.0) #uniform viewpos
Lcolor = util.vec(1.0,1.0,1.0)
Lintensity = 0.8
Expand All @@ -48,30 +48,20 @@

# Scenegraph with Entities, Components
rootEntity = scene.world.createEntity(Entity(name="RooT"))
entityCam1 = scene.world.createEntity(Entity(name="Entity1"))
scene.world.addEntityChild(rootEntity, entityCam1)
trans1 = scene.world.addComponent(entityCam1, BasicTransform(name="Entity1_TRS", trs=util.translate(0,0,-8)))


eye = util.vec(1, 0.54, 1.0)
target = util.vec(0.02, 0.14, 0.217)
up = util.vec(0.0, 1.0, 0.0)
view = util.lookat(eye, target, up)
# projMat = util.ortho(-10.0, 10.0, -10.0, 10.0, -1.0, 10.0)
# projMat = util.perspective(90.0, 1.33, 0.1, 100)
projMat = util.perspective(50.0, 1.0, 1.0, 10.0)

m = np.linalg.inv(projMat @ view)
# projMat = util.perspective(90.0, 1.33, 0.1, 100) projMat = util.perspective(50.0, 1.0, 1.0, 10.0)


entityCam2 = scene.world.createEntity(Entity(name="Entity_Camera"))
scene.world.addEntityChild(entityCam1, entityCam2)
trans2 = scene.world.addComponent(entityCam2, BasicTransform(name="Camera_TRS", trs=util.identity()))
# orthoCam = scene.world.addComponent(entityCam2, Camera(util.ortho(-100.0, 100.0, -100.0, 100.0, 1.0, 100.0), "orthoCam","Camera","500"))
orthoCam = scene.world.addComponent(entityCam2, Camera(m, "orthoCam","Camera","500"))

node4 = scene.world.createEntity(Entity(name="Object"))
scene.world.addEntityChild(rootEntity, node4)
trans4 = scene.world.addComponent(node4, BasicTransform(name="Object_TRS", trs=util.scale(0.3)@util.translate(0,0.5,0) ))
trans4 = scene.world.addComponent(node4, BasicTransform(name="Object_TRS", trs=util.translate(0,0.5,0) ))
mesh4 = scene.world.addComponent(node4, RenderMesh(name="Object_mesh"))


Expand Down Expand Up @@ -139,7 +129,6 @@

# Systems
transUpdate = scene.world.createSystem(TransformSystem("transUpdate", "TransformSystem", "001"))
camUpdate = scene.world.createSystem(CameraSystem("camUpdate", "CameraUpdate", "200"))
renderUpdate = scene.world.createSystem(RenderGLShaderSystem())
initUpdate = scene.world.createSystem(InitGLShaderSystem())

Expand Down Expand Up @@ -222,20 +211,18 @@
model_cube = util.translate(0.0,0.5,0.0)

rotate_y = 0.0
rotation_speed = 1.0
rotation_speed = 0.5

texturePath = TEXTURE_DIR / "dark_wood_texture.jpg"
texturePath = TEXTURE_DIR / "uoc_logo.png"
texture = Texture(texturePath)
shaderDec4.setUniformVariable(key='ImageTexture', value=texture, texture=True)

want_to_rotate = True
want_to_rotate = False

while running:
running = scene.render()
displayGUI_text(example_description)
scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.world.traverse_visit_pre_camera(camUpdate, orthoCam)
scene.world.traverse_visit(camUpdate, scene.world.root)
scene.world.traverse_visit(transUpdate, scene.world.root)
view = gWindow._myCamera # updates view via the imgui
# mvp_cube = projMat @ view @ model_cube

Expand All @@ -244,10 +231,10 @@
if want_to_rotate:
rotate_y += rotation_speed
else:
model_cube = trans4.trs
model_cube = trans4.l2world

mvp_terrain = projMat @ view @ terrain_trans.trs
mvp_axes = projMat @ view @ axes_trans.trs
mvp_terrain = projMat @ view @ terrain_trans.l2world
mvp_axes = projMat @ view @ axes_trans.l2world
axes_shader.setUniformVariable(key='modelViewProj', value = mvp_axes, mat4=True)

terrain_shader.setUniformVariable(key='modelViewProj', value=mvp_terrain, mat4=True)
Expand All @@ -264,7 +251,7 @@
shaderDec4.setUniformVariable(key='shininess',value=Mshininess,float1=True)
#shaderDec4.setUniformVariable(key='matColor',value=Mcolor,float3=True)


scene.world.traverse_visit(renderUpdate, scene.world.root)
scene.render_post()

scene.shutdown()
Loading