Exemple #1
0
	def update_sub(self, time_dif):
		d = vec(
			Stupid.key_state(K_h) - Stupid.key_state(K_f),
			Stupid.key_state(K_r) - Stupid.key_state(K_z),
			Stupid.key_state(K_g) - Stupid.key_state(K_t),
		) * time_dif * 5

		self.q = (self.q + Stupid.key_state(K_c, True)) % 3
		[self.eye, self.target, self.up][self.q] += d
Exemple #2
0
	def update_sub(self, time_dif):

		if Stupid.key_state(K_p, True):
			self.obj.save("tmp.obj")

		if Stupid.key_state(K_y, True):
			self.volume = self.obj.calc_volume()
		if Stupid.key_state(K_x, True):
			self.surface = self.obj.calc_surface()

		if Stupid.key_state(K_c, True):
			self.obj.noise(self.sigma)
		if Stupid.key_state(K_v, True):
			self.obj.smooth(self.alpha)

		if Stupid.key_state(K_b, True):
			self.silhouette = not self.silhouette

		self.sigma += (Stupid.key_state(K_r, True) - Stupid.key_state(K_f, True)) * 0.01
		self.alpha += (Stupid.key_state(K_t, True) - Stupid.key_state(K_g, True)) * 0.01
Exemple #3
0
	def update_sub(self, dt):
		self.switch ^= Stupid.key_state(K_c, True)
		self.blinn ^= Stupid.key_state(K_b, True)
		self.sections += Stupid.key_state(K_r, True)
		self.sections -= Stupid.key_state(K_f, True)
		self.shininess += Stupid.key_state(K_t, True)
		self.shininess -= Stupid.key_state(K_g, True)
Exemple #4
0
class Normal(Entity):
	def __init__(self, obj):
		Entity.__init__(self)
		self.obj = obj
		self.shade = Shade("""
varying vec3 normal;
void main(void) {
	normal = gl_Normal;
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}""", """
varying vec3 normal;
void main(void) {
	vec3 h = vec3(0.5, 0.5, 0.5);
	gl_FragColor = vec4(normalize(normal.xyz) * h + h, 1);
}""")

	def render_sub(self):
		self.shade.on()
		self.obj.render()
		self.shade.off()


if __name__ == "__main__":
	stupid = Stupid("Stupid [ CGI - Aufgabe 5 ]")
	obj = ObjObject(sys.argv[1])
	stupid.add(Trick(obj))
	stupid.add(Normal(obj))
	stupid.mainloop()


Exemple #5
0
	def update_sub(self, time_dif):
		self.p.x += (Stupid.key_state(K_r) - Stupid.key_state(K_f)) * time_dif
		self.p.y += (Stupid.key_state(K_t) - Stupid.key_state(K_g)) * time_dif
		self.p.z += (Stupid.key_state(K_z) - Stupid.key_state(K_h)) * time_dif
		if Stupid.key_state(K_b, True): self.bfc = not self.bfc
		if Stupid.key_state(K_i, True): self.inverse = not self.inverse
Exemple #6
0
		glCallList(self.dot)
		glPopMatrix()
		glPushMatrix()
		glTranslate(*self.target)
		glCallList(self.dot)
		glPopMatrix()

		glLineWidth(3)
		glDisable(GL_LIGHTING)
		glBegin(GL_LINES)
		glVertex(self.eye)
		glVertex(self.target)
		glEnd()
		glEnable(GL_LIGHTING)

		glColor(1, 1, 1)
		font.put(5, 100, "eye: %s" % self.eye)
		font.put(5, 110, "target: %s" % self.target)
		font.put(5, 120, "up: %s" % self.up)



if __name__ == "__main__":

	stupid = Stupid("Stupid [ CGI - Aufgabe 2 ]")
	stupid.add(Contra())
	stupid.add(Suck())
	stupid.mainloop()


Exemple #7
0
			self.surface = self.obj.calc_surface()

		if Stupid.key_state(K_c, True):
			self.obj.noise(self.sigma)
		if Stupid.key_state(K_v, True):
			self.obj.smooth(self.alpha)

		if Stupid.key_state(K_b, True):
			self.silhouette = not self.silhouette

		self.sigma += (Stupid.key_state(K_r, True) - Stupid.key_state(K_f, True)) * 0.01
		self.alpha += (Stupid.key_state(K_t, True) - Stupid.key_state(K_g, True)) * 0.01



# evil hack
def get_eye():
	global eye
	return eye

if __name__ == "__main__":

	stupid = Stupid("Stupid [ CGI - Aufgabe 3 ]")
	global eye
	eye = stupid.eye

	stupid.add(Squeeze(sys.argv[1]))
	stupid.mainloop()