Exemplo n.º 1
0
int Mesh::AddPoint(const Point3 &position, const Vec3 &normal, const Color &color,
                   float tu, float tv) {
  memcpy(&points_[3*num_points_], position.GetData(), 3 * sizeof(float));
  if (normals_ != 0)
    memcpy(&normals_[3*num_points_], normal.GetData(), 3 * sizeof(float));
  if (colors_ != 0)
    memcpy(&colors_[4*num_points_], color.GetData(), 4 * sizeof(float));
  if (textures_ != 0) {
    texture_coords_[2*num_points_+0] = tu;
    texture_coords_[2*num_points_+1] = tv;
  }
  return (num_points_++);
}
Exemplo n.º 2
0
void Mesh::SetNormal(int index, const Vec3 &normal) {
  memcpy(&normals_[3*index], normal.GetData(), 3 * sizeof(float));
}