Example #1
0
File: ff.go Project: skyview059/vu
// ff demonstrates flow field path finding by having a bunch of chasers and
// a goal. The goal is randomly reset once all the chasers have reached it.
// Restarting the example will create a different random grid.
func ff() {
	ff := &fftag{}
	if err := vu.New(ff, "Flow Field", 400, 100, 750, 750); err != nil {
		log.Printf("ff: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #2
0
File: rl.go Project: skyview059/vu
// rl, random levels, tests higher level graphics functionality.
// This includes:
//   • vu culling/reducing the total objects rendered based on distance.
//   • vu 2D overlay scene, in this case a minimap.
//   • vu grid generation. Try numbers 0-9.
//   • vu engine statistics.
// rl also tests camera movement that includes holding multiple movement keys
// at the same time. The example does not have collision detection so you can
// literally run through the maze.
func rl() {
	rl := &rltag{}
	if err := vu.New(rl, "Random Levels", 400, 100, 800, 600); err != nil {
		log.Printf("rl: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #3
0
File: sg.go Project: skyview059/vu
// sg tests the scene graph by building up a movable character that has multiple
// layers of sub-parts. The scene graph is demonstrated by changing the top level
// location, orientation and having it affect the sub-parts. Sg also tests adding
// and removing parts from a scene graph. Note that transparency sorting is
// handled by the engine.
//
// This example has a bit more code due to playing around with what can best
// be described as merging and splitting voxels.
func sg() {
	sg := &sgtag{}
	if err := vu.New(sg, "Scene Graph", 400, 100, 800, 600); err != nil {
		log.Printf("sg: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #4
0
File: ps.go Project: toophy/vu
// ps demonstrates a CPU-based particle system and a GPU-based (shader only)
// particle system with support provided by vu/Effect.
func ps() {
	ps := &pstag{}
	if err := vu.New(ps, "Particle System", 400, 100, 800, 600); err != nil {
		log.Printf("ps: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #5
0
File: tm.go Project: toophy/vu
// tm demonstrates creating, texturing, and rendering a dynamic terrain map
// from a generated height map. The intent is to mimic a surface/land map.
func tm() {
	tm := &tmtag{}
	if err := vu.New(tm, "Terrain Map", 400, 100, 800, 600); err != nil {
		log.Printf("tm: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #6
0
File: bb.go Project: skyview059/vu
// bb tests the engines handling of billboards and banners as well
// as combining multiple textures using shaders.
func bb() {
	bb := &bbtag{}
	if err := vu.New(bb, "Billboarding & Banners", 400, 100, 800, 600); err != nil {
		log.Printf("bb: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #7
0
File: lt.go Project: skyview059/vu
// lt tests the engines handling of some of the engine lighting shaders.
// It also checks the conversion of light position and normal vectors
// needed for proper lighting.
func lt() {
	lt := &lttag{}
	if err := vu.New(lt, "Lighting", 400, 100, 800, 600); err != nil {
		log.Printf("lt: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #8
0
File: kc.go Project: toophy/vu
// kc explores treating the keyboard as a controller.
// It assigns each keyboard key a unique symbol.
func kc() {
	kc := &kctag{}
	if err := vu.New(kc, "Keyboard Controller", 200, 200, 900, 400); err != nil {
		log.Printf("kc: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #9
0
File: ma.go Project: skyview059/vu
// ma, model animation, is an example of loading and animating a model using
// skeletel animation. It is based on the example data provided in the IQM
// Development kit from http://sauerbraten.org/iqm.
func ma() {
	ma := &matag{}
	if err := vu.New(ma, "Model Animation", 400, 100, 800, 600); err != nil {
		log.Printf("ma: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #10
0
File: fm.go Project: toophy/vu
// fm demos and tests the vu/form package by visualizing grid layouts
// created from string based layout plans. Overall this is an experiment
// in trying to provide some application GUI support.
func fm() {
	fm := &fmtag{}
	if err := vu.New(fm, "Form Layout", 400, 100, 800, 600); err != nil {
		log.Printf("fm: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #11
0
File: rc.go Project: toophy/vu
// rc demonstrates ray-casting and mouse-picking. In this example the plane
// is centered at the origin and the camera is tilted 45 degrees around X.
func rc() {
	rc := &rctag{}
	if err := vu.New(rc, "Ray Cast", 400, 100, 800, 600); err != nil {
		log.Printf("rc: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #12
0
File: cr.go Project: toophy/vu
// cr, collision resolution, demonstrates simulated physics by having balls bounce
// on a floor. The neat thing is that after the initial locations have been set
// the physics simulation (vu/move) handles all subsequent position updates.
func cr() {
	cr := &crtag{}
	if err := vu.New(cr, "Collision Resolution", 400, 100, 800, 600); err != nil {
		log.Printf("cr: error initializing engine %s", err)
	}
	defer catchErrors()
}
Example #13
0
File: tt.go Project: skyview059/vu
// tt demonstrates rendering to a scene to a texture, and then
// displaying the scene on a quad. Background info at:
//   http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
//   http://processors.wiki.ti.com/index.php/Render_to_Texture_with_OpenGL_ES
//   http://in2gpu.com/2014/09/24/render-to-texture-in-opengl/
//   http://www.lighthouse3d.com/tutorials/opengl_framebuffer_objects/
func tt() {
	tt := &totex{}
	if err := vu.New(tt, "Render to Texture", 400, 100, 800, 600); err != nil {
		log.Printf("tt: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #14
0
File: sm.go Project: skyview059/vu
// sm, shadow map, tests the engines handling of shadow maps
// and multipass rendering. These are hard shadows.
// FUTURE: upgrade shader to PCSS ie:
//   http://developer.download.nvidia.com/whitepapers/2008/PCSS_Integration.pdf
func sm() {
	sm := &smtag{}
	if err := vu.New(sm, "Shadow Map", 400, 100, 800, 600); err != nil {
		log.Printf("sm: error starting engine %s", err)
	}
	defer catchErrors()
}
Example #15
0
// main recovers saved preferences and initializes the game.
func main() {
	mp := &bampf{}
	var err error
	var x, y int
	x, y, mp.ww, mp.wh, mp.mute = mp.prefs()
	mp.setLogger(mp)
	if err = vu.New(mp, "Bampf", x, y, mp.ww, mp.wh); err != nil {
		logf("Failed to initialize engine %s", err)
		return
	}
	defer catchErrors()
}