![]() To create curves, use the bezierVertex() or curveVertex() instead.Ī Processing method to load a 3D primitive or vertices into a PShape-the method can also handle parameters for the 3D primitives BOX and SPHERE. Vertices are connected with straight lines. loadShape()Ī Processing method to load a Scalable Vector Graphic, or svg, file into a PShape objectĪ Processing method to start recording a shape using vertices-we can connect vertices with the following modes: POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP.Ī Processing method to stop recording a shape using verticesĪ Processing method to add a vertex point to a shape using either x and y values or x, y, and z values for two and three dimensions, respectively-it takes only two vertices to create a shape, but we can add thousands and are only limited by the memory installed in our device. Let’s take a look at the methods we’ll use to load and create the 3D scenes in this chapter. We can use the class to load 2D vector shape files ( svg) and 3D object files ( obj) and work with 3D vertices generated algorithmically. In this chapter, we’ll use Processing’s PShape features for all the projects we’ll create. Let’s look first at the classes and methods Processing provides to us to work with shapes and 3D objects-we’ll use them throughout the chapter. The scene consists of Earth and the Moon&-revisiting code from Apply an Image Texture, and face recognition features we’ve explored in Detect Faces. We’ll use our gaze to control the point of view of the virtual camera. We’ll conclude the chapter by bringing several of these new features together in a single application that also makes use of Android’s ability to recognize faces. The gyro makes a useful input device, and we’ll use it to rotate the figure on the screen by rotating the device itself. To give users a way to interact with the Möbius strip, we’ll introduce and use the built-in gyro sensor, a component that now ships with the latest Androids. We’ll learn how to store the information we need to draw the figure in the GPU’s memory and thereby radically increase the speed with which it’s rendered as well as the number of times per second the image is refreshed. We’ll also create a figure algorithmically and construct a 3D Möbius strip using individual vertices that we record. To demonstrate how we can use PShape to manipulate 3D objects, we’ll load a model of One World Trade Center from an Object file, including its materials and textures, display it on the touch screen, and then rotate and zoom the figure using multitouch gestures. We’ll also see how to modify the SVG file to highlight typical tossup states during recent presidential elections. Because this format is based on vectors and vertices, users won’t lose graphics detail or quality as they zoom the map. To show the support that PShape provides for handling SVG files, we’ll start with a US map saved in that format, and then we’ll give users the ability to zoom and pan over its features. PShape leverages the OpenGL hardware acceleration found on most recent Android phones and tablets and is a great example of how we can tackle complex operations with just one class and a few lines of Processing code. ![]() The PShape class-which we’ll use throughout the chapter for much of this work&-makes it easy for us to work with Scalable Vector Graphics ( SVG) and 3D Object ( OBJ) files and to record vertices that define custom shapes and figures algorithmically. Processing’s features for handling shapes and other figures are quite extraordinary. ![]() Once we’ve mastered those tasks, we’ll know all we need to create interactive 3D scenes and games and to organize information three-dimensionally. ![]() With the basic understanding we’ve gained running 3D sketches on the Android in Chapter 11, Introducing 3D Graphics with OpenGL, we’re now ready to tackle some more advanced tasks: working with shapes and objects, generating our own geometric figures, and shifting the point of view of the virtual camera that determines how our scene is rendered. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |