Ejemplo n.º 1
0
func NewEngine(r renderer.Renderer) Engine {
	fpsMeter := renderer.CreateFPSMeter(1.0)
	fpsMeter.FpsCap = 144

	sceneGraph := renderer.CreateSceneGraph()
	updatableStore := NewUpdatableStore()
	camera := renderer.CreateCamera()

	engine := &EngineImpl{
		fpsMeter:       fpsMeter,
		sceneGraph:     sceneGraph,
		updatableStore: updatableStore,
		renderer:       r,
		camera:         camera,
	}

	engine.initNodes()
	sceneGraph.Add(engine.opaqueNode)

	engine.transparentNode.RendererParams = renderer.NewRendererParams()
	engine.transparentNode.RendererParams.CullBackface = false
	engine.transparentNode.RendererParams.DepthMask = false
	sceneGraph.AddTransparent(engine.transparentNode)

	engine.orthoNode.RendererParams = renderer.NewRendererParams()
	engine.orthoNode.RendererParams.CullBackface = false
	engine.orthoNode.RendererParams.Unlit = true
	return engine
}
Ejemplo n.º 2
0
func NewHeadlessEngine() Engine {
	updatableStore := NewUpdatableStore()
	fpsMeter := renderer.CreateFPSMeter(1.0)
	fpsMeter.FpsCap = 144

	engine := &EngineImpl{
		fpsMeter:       fpsMeter,
		updatableStore: updatableStore,
	}

	engine.initNodes()
	return engine
}