Exemple #1
0
         "position": (0, 0, 0),
         "scale": (25, 25, 25),
         "material": {
             "wire": False,
             "color": (200, 63, 63),
             "map": "none"
         },
         "physics": {
             "rigidBody": False,
             "velocity": (0, 0, 0),
             "friction": 0.05,
             "bounce": 0,
             "control": False
         }
     }
     scene.append(aaa)
     sel = len(scene) - 1
     sleep(0.1)
 if (guiEvents[28]["pressed"]):
     if (sel != 0):
         scene.pop(sel)
         sel = 0
         print("Removed Mesh.")
     else:
         easygui.msgbox(msg="Cannot Remove Mesh", title="Error:")
     sleep(0.1)
 if (guiEvents[29]["pressed"]):
     d.fill(world["background"])
     render(scene)
     # antialias()
     pg.image.save(d, "out.png")
Exemple #2
0
         "material":{
             "wire":False,
             "color":(200,63,63),
             "metal":1,
             "map":"none",
             "alpha":255
         },
         "physics": {
             "rigidBody":True,
             "velocity":(0,0,0),
             "friction":0.05,
             "bounce":0,
             "control":False
             }
         }
     scene.append(blankMesh)
     sel = len(scene)-1
     sleep(0.1)
 elif guiEvents[8]["pressed"]: # Remove current mesh
     if sel != 0:
         scene.pop(sel)
         sel-=1
     else:
         easygui.msgbox("Cannot Remove Mesh","Error")
     sleep(0.1)
 elif guiEvents[9]["pressed"]: # Render and export
     
     fnam = easygui.filesavebox(filetypes=['*.png','*.jpg','*.*'])
     
     if fnam != None:
         rendrType = easygui.choicebox("Shading:","Render and Export",["Flat","Smooth"])
Exemple #3
0
            chcs = easygui.choicebox("Shape:", "Add New Mesh", [
                "Cube", "Pyramid", "Octahedron", "Sphere", "PlaneXZ",
                "PlaneXY", "PlaneYZ", "SmoothCube", "", "Terrain", "",
                "Load OBJ", "Export OBJ", "Load", "Save"
            ])
            if chcs != None:
                if chcs == 'Load OBJ':
                    fnam = easygui.fileopenbox(filetypes=['*.obj', '*.*'])
                    if fnam != None:
                        try:
                            f = open(fnam, 'r')
                            lobj = loadobj(f.read())
                            blankm['shape'] = lobj[0]
                            f.close()
                            blankm['name'] = lobj[1]
                            scene.append(blankm)
                        except:
                            easygui.msgbox('Invalid OBJ File', 'Error')
                elif chcs == 'Save':

                    fnamn = easygui.filesavebox(default='mesh/',
                                                filetypes=['*.ivm', '*.*'])
                    if fnamn != None:
                        with open(fnamn, 'w') as ofl:
                            ofl.write(json.dumps({"mesh": scene[sel]}))
                elif chcs == 'Load':

                    fnamn = easygui.fileopenbox(default='mesh/',
                                                filetypes=['*.ivm', '*.*'])
                    if fnamn != None: