43 ( |
43 ( |
44 std::vector<gl::Polygon>& polygons, |
44 std::vector<gl::Polygon>& polygons, |
45 GetPolygonsContext* context |
45 GetPolygonsContext* context |
46 ) const |
46 ) const |
47 { |
47 { |
48 Model* model = this->resolve(context->documents); |
48 Model* referencedModel = this->resolve(context->modelId, context->documents); |
49 if (model != nullptr) |
49 if (referencedModel != nullptr) |
50 { |
50 { |
51 const bool needInverting = glm::determinant(this->transformation) < 0; |
51 const bool needInverting = glm::determinant(this->transformation) < 0; |
52 const std::vector<gl::Polygon> modelPolygons = model->getPolygons(context->documents); |
52 const std::vector<gl::Polygon> modelPolygons = referencedModel->getPolygons(context->documents); |
53 polygons.reserve(polygons.size() + modelPolygons.size()); |
53 polygons.reserve(polygons.size() + modelPolygons.size()); |
54 for (gl::Polygon polygon : modelPolygons) |
54 for (gl::Polygon polygon : modelPolygons) |
55 { |
55 { |
56 for (unsigned int i = 0; i < polygon.numPolygonVertices(); i += 1) |
56 for (unsigned int i = 0; i < polygon.numPolygonVertices(); i += 1) |
57 { |
57 { |
81 void ldraw::SubfileReference::invert() |
81 void ldraw::SubfileReference::invert() |
82 { |
82 { |
83 this->isInverted = not this->isInverted; |
83 this->isInverted = not this->isInverted; |
84 } |
84 } |
85 |
85 |
86 Model* ldraw::SubfileReference::resolve(DocumentManager* documents) const |
86 Model* ldraw::SubfileReference::resolve(const ModelId callingModelId, DocumentManager* documents) const |
87 { |
87 { |
88 return documents->findModelByName(this->referenceName); |
88 return documents->findDependencyByName(callingModelId, this->referenceName); |
89 } |
89 } |
90 |
90 |
91 ldraw::Object::Type ldraw::SubfileReference::typeIdentifier() const |
91 ldraw::Object::Type ldraw::SubfileReference::typeIdentifier() const |
92 { |
92 { |
93 return Type::SubfileReference; |
93 return Type::SubfileReference; |