You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ugeentitywavefrontobj.cpp 674B

123456789101112131415161718192021
  1. #include "ugeentitywavefrontobj.h"
  2. UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, QObject *parent)
  3. : UGEEntity(parent)
  4. , _obj(obj)
  5. {
  6. }
  7. void UGEEntityWaveFrontObj::onDraw(AbstractRenderDevice *device)
  8. {
  9. QList<QList<WaveFrontObjFaceVertex> > faces = _obj->getFaces();
  10. QList<Vector3D> vertexes = _obj->getVertexes();
  11. for (int i = 0; i < faces.size(); ++i) {
  12. QList<WaveFrontObjFaceVertex> face = faces[i];
  13. QList<ColorVector3D> poly;
  14. for (int j = 0; j < face.size(); ++j) {
  15. poly.append(ColorVector3D(Qt::black, vertexes[face[j].vertexPosition - 1]));
  16. }
  17. drawPolygon(device, poly);
  18. }
  19. }