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 995B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "ugeentitywavefrontobj.h"
  2. UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, UGameEngine *engine, QObject *parent)
  3. : UGEEntity(engine, parent)
  4. , _obj(obj)
  5. {
  6. }
  7. UGEEntityWaveFrontObj::UGEEntityWaveFrontObj(WaveFrontObj *obj, UGameEngine *engine)
  8. : UGEEntity(engine)
  9. , _obj(obj)
  10. {
  11. }
  12. void UGEEntityWaveFrontObj::onDraw(AbstractRenderDevice *device)
  13. {
  14. QList<QList<WaveFrontObjFaceVertex> > faces = _obj->getFaces();
  15. QList<Vector3D> vertexes = _obj->getVertexes();
  16. for (int i = 0; i < faces.size(); ++i) {
  17. QList<WaveFrontObjFaceVertex> face = faces[i];
  18. QList<ColorVector3D> poly;
  19. for (int j = 0; j < face.size(); ++j) {
  20. poly.append(ColorVector3D(Qt::black, vertexes[face[j].vertexPosition - 1]));
  21. }
  22. drawPolygon(device, poly);
  23. }
  24. }
  25. Vector3D UGEEntityWaveFrontObj::getVectorNearestIntesection(const Vector3D &vector, const Vector3D &pos, bool *ok)
  26. {
  27. *ok = false;
  28. return Vector3D();
  29. }