Panda3D
Loading...
Searching...
No Matches
xFileFace.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file xFileFace.cxx
10 * @author drose
11 * @date 2001-06-19
12 */
13
14#include "xFileFace.h"
15#include "xFileMesh.h"
16#include "eggPolygon.h"
17
18/**
19 *
20 */
21XFileFace::
22XFileFace() {
23 _material_index = -1;
24}
25
26/**
27 * Sets the structure up from the indicated egg data.
28 */
30set_from_egg(XFileMesh *mesh, EggPolygon *egg_poly) {
31 // Walk through the polygon's vertices in reverse order, to change from
32 // Egg's counter-clockwise convention to DX's clockwise.
33 EggPolygon::reverse_iterator vi;
34 for (vi = egg_poly->rbegin(); vi != egg_poly->rend(); ++vi) {
35 EggVertex *egg_vertex = (*vi);
36 Vertex v;
37 v._vertex_index = mesh->add_vertex(egg_vertex, egg_poly);
38 v._normal_index = mesh->add_normal(egg_vertex, egg_poly);
39 _vertices.push_back(v);
40 }
41
42 _material_index = mesh->add_material(egg_poly);
43}
A single polygon.
Definition eggPolygon.h:24
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
Definition eggVertex.h:39
void set_from_egg(XFileMesh *mesh, EggPolygon *egg_poly)
Sets the structure up from the indicated egg data.
Definition xFileFace.cxx:30
This is a collection of polygons; i.e.
Definition xFileMesh.h:45
int add_vertex(EggVertex *egg_vertex, EggPrimitive *egg_prim)
Creates a new XFileVertex, if one does not already exist for the indicated vertex,...
int add_normal(EggVertex *egg_vertex, EggPrimitive *egg_prim)
Creates a new XFileNormal, if one does not already exist for the indicated normal,...
int add_material(EggPrimitive *egg_prim)
Creates a new XFileMaterial, if one does not already exist for the indicated material,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.