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_++); }
void Mesh::SetColor(int index, const Color &color) { memcpy(&colors_[4*index], color.GetData(), 4 * sizeof(float)); }