
com.ardor3d.example.canvas.ExampleScene Maven / Gradle / Ivy
/**
* Copyright (c) 2008-2012 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
* Ardor3D is free software: you can redistribute it and/or modify it
* under the terms of its license which may be found in the accompanying
* LICENSE file or at .
*/
package com.ardor3d.example.canvas;
import com.ardor3d.annotation.MainThread;
import com.ardor3d.framework.Scene;
import com.ardor3d.intersection.PickResults;
import com.ardor3d.math.Ray3;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.util.ContextGarbageCollector;
import com.ardor3d.util.GameTaskQueue;
import com.ardor3d.util.GameTaskQueueManager;
/**
* The framework should provide a default implementation of a scene, probably with a root node and a stats node, just
* like today. Probably, controllers don't belong here, but I also don't think they belong in the Node API.
*/
public final class ExampleScene implements Scene {
private final Node root;
public ExampleScene() {
root = new Node("root");
}
public Node getRoot() {
return root;
}
@MainThread
public boolean renderUnto(final Renderer renderer) {
// Execute renderQueue item
GameTaskQueueManager.getManager(ContextManager.getCurrentContext()).getQueue(GameTaskQueue.RENDER).execute(
renderer);
ContextGarbageCollector.doRuntimeCleanup(renderer);
renderer.draw(root);
return true;
}
public PickResults doPick(final Ray3 pickRay) {
// does nothing.
return null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy