"Stage3D Learning Notes continued" Real 3D World (ii): Display model

Source: Internet
Author: User

Although we entered the true 3D world, but the previous chapter of the demo is still shown a plane, although our plane in 3D space rotation can see a little 3D perspective effect, but since it is true 3D, it is necessary to take out a dot 3D look!

If we're going to show the three-dimensional model, we're going to say goodbye to the time of writing vertex data directly with the code, think of the last section, the plane's quadrilateral handwritten vertices may be passable, but it's a bit hard to write 8 vertex data for a cube, if it's a more complex shape?

To display a 3D model, you need a 3D model file in a specific format, 3D model files are generally created with the 3D modeling tool, and the model is exported to a 3D model data file in a specific format after the completion of the artwork, with the common format of obj, MD2, MD5, and Daes, Of course more cases are custom binary formats (smaller size parsing is faster, but sacrificing readability and versatility).

For a particular format of a file, we need to write a specific parsing class to parse, parsing the data in the file into the vertex data that we can use directly.

We use the Objparser class, which is provided in the book to parse the obj data file, and use this class to obtain data such as the vertex position, Uvs, and so on, which are defined in the file directly after parsing the obj file.

Objparser class

After getting the data in the model file, it can be drawn to the 3D stage, the drawing method and the previous section have been, the following directly on the demo:

Code

"Stage3D Learning Notes continued" Real 3D World (ii): Display model

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.