Пример #1
0
from Engine3D import Engine
from GeometricShapes import Mesh
import pygame

window = pygame.display.set_mode((700, 700))
engine = Engine(window)

mesh = Mesh([350, 350, 0], 300, 10)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

    window.fill((91, 91, 91))
    mesh.rotate_mode()

    # Drawing the objects with its depth map. The further surfaces are the darker its color
    engine.draw_depth_map(mesh)

    pygame.display.flip()
    pygame.time.Clock().tick(60)
Пример #2
0
from Engine3D import Engine
from GeometricShapes import Mesh
import pygame

# Creating PyGame Surface
window = pygame.display.set_mode((700, 700))

# Creating Engine3D object with the pygame surface
engine = Engine(window)

# Creating Mesh in position [250, 250, 0] and size 300px and 10 cells each side
mesh = Mesh([350, 350, 0], 300, 10)

while True:
    # PyGame key event
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

    # Filling the screen
    window.fill((91, 91, 91))

    # Setting rotation mode by the mouse on this object
    mesh.rotate_mode()

    # Adding to draw list the objects [object, isPoints, isLines, isSurfaces]
    engine.addToDraw([mesh, True, True, True])

    # Draw the world
    engine.draw()
Пример #3
0
from Engine3D import Engine
import pygame
from GeometricShapes import MobiusStrip

window = pygame.display.set_mode((700, 700))
engine = Engine(window)

m = MobiusStrip([350, 350, 0], 100, 10)
m.surface_set([0, 0, 0], [255, 0, 255])
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

    window.fill((91, 91, 91))

    m.rotate_mode()
    engine.addToDraw([m, False, False, True])

    engine.draw()

    pygame.display.flip()
    pygame.time.Clock().tick(60)
Пример #4
0
from Engine3D import Engine
import pygame
from data.vector import Vector

window = pygame.display.set_mode((700, 700))
engine = Engine(window)

# Create your own shapes
points = [
    Vector(300, 300, 0),
    Vector(400, 300, 0),
    Vector(400, 400, 0),
    Vector(300, 400, 0)
]

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

    window.fill((91, 91, 91))

    # Draws a simple surface that bounded by points with the color [255, 100, 100] on the window
    engine.draw_surface(points, [255, 100, 100], window)

    # Rotate the shape of points with the rotate point [300, 300, 0] .005, .005, -.001 degrees on axes OX, OY, OZ
    engine.rotate(points, [300, 300, 0], .005, .005, -.001)

    pygame.display.flip()
    pygame.time.Clock().tick(60)