Author: AlexMeyer
Date: 2008-03-19 19:32:16 -0400 (Wed, 19 Mar 2008)
New Revision: 1181

Modified:
   trunk/pysoy/examples/pysoy_primer.py
Log:
Added comments, added a while loop, cleaned up a tiny bit.

Modified: trunk/pysoy/examples/pysoy_primer.py
===================================================================
--- trunk/pysoy/examples/pysoy_primer.py        2008-03-19 17:18:49 UTC (rev 
1180)
+++ trunk/pysoy/examples/pysoy_primer.py        2008-03-19 23:32:16 UTC (rev 
1181)
@@ -1,19 +1,34 @@
-## The PySoy Primer Tutorial
+# The PySoy Primer Tutorial - A Spinning Cube
 #
-# This version has been modified to work with the lastest
+# This version has been modified to work with the latest
 # svn trunk.
 
 import soy
+from time import *
+
+# Initialize a window and a 3D scene (empty space) for objects
 scr = soy.Screen()
-win = soy.Window(scr,"Test Window")
+win = soy.Window(scr, "A Spinning Cube")
 sce = soy.scenes.Scene()
-cube = soy.shapes.Box(1,1,1) # Step 1: Shape
-mat = soy.materials.Material()# Step 2: Material
-mat.shininess = 5 # Looks nicer :D
-body =soy.bodies.Body(scene=sce,model=soy.models.Shape(mat),shape=cube) # Step 
3: Body
+
+# Create a cube with a shape, material (and shininess), and a body.
+cube = soy.shapes.Box(1, 1, 1) # Step 1: Shape
+mat = soy.materials.Material() # Step 2: Material
+mat.shininess = 5 # Looks nicer (modifies the applied specular lighting; play 
with this setting to see how it affects appearance)
+body = soy.bodies.Body(scene=sce, model=soy.models.Shape(mat), shape=cube) # 
Step 3: Body
+
+# Put a light and camera into the initialized screen
 light = soy.bodies.Light(sce)
 camera = soy.bodies.Camera(sce)
-pro = soy.widgets.Projector(win,camera=camera)
-camera.position = (0,0,5.0)
+pro = soy.widgets.Projector(win, camera=camera)
+
+# Move them into an appropriate position (where they aren't directly in the 
middle of the cube)
+camera.position = (0,0, 5.0)
 light.position = (0.5, 1.0, 5.0)
-body.rotation = (1,1,1) # Rotate the cube 1 unit in the X axis,1 unit in the Y 
axis and 1 unit in the Z axis
\ No newline at end of file
+
+# Rotate the cube 1 unit in the X-axis, 1 unit in the Y-axis and 1 unit in the 
Z-axis
+body.rotation = (1, 1, 1)
+
+#  Main loop: keeps the window open and rotates the cube with each subsequent 
loop
+while True:
+    sleep(.1)
\ No newline at end of file

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to