The previous section has taught you to buildNVisionRendered scene, you can then render the object in the scene.,Let's proceed to the previous section of the code.
1, create a new class, Inherit Nvsceneplay, such as
2, instance of the scene, add to the management queue, add code such as, the meaning and purpose of each sentence to see comments:
Code:
myfirstscene *firstscene = [[Myfirstscene alloc] initwithname:@ "First_scene"];
[[Nvappdirector Sharednvappdirector] addsceneplay:@ "Main_sceneplay" scene:firstscene];
3, entered the myfirstscene.m, because inherited the nvsceneplay, therefore has the parent class so the method.
we override the life cycle methods of the parent class in code such as:
4. Create a cube
Add header file#import ' NVPrimiteves.h '
link the header fileClick in to see the class is mainly the instance of some basic shape class, including plane, cube, fillet cube, cylinder, ball, spring and so on.
in theOnCreatethe method in the instance sessionNvboxwidgetFor example, you can try to modify the coordinates and zoom androtate to see the effect. Other basic models use similar, and you can try them yourself.
Code:
Create a cube
Nvboxwidget *cube = [[Nvboxwidget alloc] initwithsceneplay:self widgetname:@ "Cube"];
Set coordinates
[Cube setposition:nvposition (0, 0, 0)];
Set the zoom ratio
[Cube Setscale:nvposition (1.0, 1.0, 1.0)];
Add an object to a scene
[Self addwidget:cube];
5,run the project, test, OK, a cube relief to the screen.
This chapter is the end of this tutorial, and the next section teaches you how to put the material on the cube.
Welcome to contact :
- Contact information: +86 18801341080
- E-mail: [email protected]
- Website: http://www.nvisionxr.com/
- QQ Group: 416802300
iOS tutorial three--nvisionxr rendering a cube