MCPcopy Create free account
hub / github.com/OGRECave/ogre / main

Method main

Samples/Java/Example.java:8–54  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

6 }
7
8 public static void main(String[] args) {
9 final ApplicationContext ctx = new ApplicationContext();
10 ctx.initApp();
11
12 ctx.addInputListener(new InputListener() {
13 public boolean keyPressed(KeyboardEvent evt)
14 {
15 if (evt.getKeysym().getSym() == BitesConstants.SDLK_ESCAPE)
16 ctx.getRoot().queueEndRendering();
17 return true;
18 }
19 });
20
21 Root root = ctx.getRoot();
22 SceneManager scnMgr = root.createSceneManager();
23 ShaderGenerator.getSingleton().addSceneManager(scnMgr);
24
25 scnMgr.setAmbientLight(new ColourValue(.1f, .1f, .1f));
26
27 Light light = scnMgr.createLight("MainLight");
28 SceneNode lightnode = scnMgr.getRootSceneNode().createChildSceneNode();
29 lightnode.setPosition(0, 10, 15);
30 lightnode.attachObject(light);
31
32 Camera cam = scnMgr.createCamera("myCam");
33 SceneNode camnode = scnMgr.getRootSceneNode().createChildSceneNode();
34 camnode.attachObject(cam);
35 camnode.setPosition(0, 0, 15);
36
37 cam.setNearClipDistance(5);
38 cam.setAutoAspectRatio(true);
39
40 CameraMan camman = new CameraMan(camnode);
41 camman.setStyle(CameraStyle.CS_ORBIT);
42 camman.setYawPitchDist(new Radian(0f), new Radian(0.3f), 15);
43 ctx.addInputListener(camman);
44
45 Viewport vp = ctx.getRenderWindow().addViewport(cam);
46 vp.setBackgroundColour(new ColourValue(.3f, .3f, .3f));
47
48 Entity ent = scnMgr.createEntity("Sinbad.mesh");
49 SceneNode node = scnMgr.getRootSceneNode().createChildSceneNode();
50 node.attachObject(ent);
51
52 ctx.getRoot().startRendering();
53 ctx.closeApp();
54 }
55}

Callers

nothing calls this directly

Calls 15

createSceneManagerMethod · 0.95
setAmbientLightMethod · 0.95
createLightMethod · 0.95
getRootSceneNodeMethod · 0.95
attachObjectMethod · 0.95
createCameraMethod · 0.95
setAutoAspectRatioMethod · 0.95
setStyleMethod · 0.95
setYawPitchDistMethod · 0.95
createEntityMethod · 0.95
initAppMethod · 0.80
addSceneManagerMethod · 0.80

Tested by

no test coverage detected