示例#1
0
文件: Mesh.cpp 项目: zorbathut/glop
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_++);
}
示例#2
0
文件: Mesh.cpp 项目: zorbathut/glop
void Mesh::SetNormal(int index, const Vec3 &normal) {
  memcpy(&normals_[3*index], normal.GetData(), 3 * sizeof(float));
}