|
@ -14,7 +14,15 @@ SurfaceFactory * SurfaceFactory::instance(){ |
|
|
|
|
|
|
|
|
BaseSurface * SurfaceFactory::createSurface(int type){ |
|
|
BaseSurface * SurfaceFactory::createSurface(int type){ |
|
|
if(type == SurfaceType::TRIANGLE_SURFACE){ |
|
|
if(type == SurfaceType::TRIANGLE_SURFACE){ |
|
|
|
|
|
return createTriangleSurface(); |
|
|
|
|
|
}else if(type == SurfaceType::QUAD_SURFACE){ |
|
|
|
|
|
return createQuadSurface(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
throw runtime_error("Undefined surface type"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TriangleSurface * SurfaceFactory::createTriangleSurface(){ |
|
|
vector <ofVec2f> vertices; |
|
|
vector <ofVec2f> vertices; |
|
|
float margin = 50.0f; |
|
|
float margin = 50.0f; |
|
|
vertices.push_back(ofVec2f((float)ofGetWidth() / 2.0f, margin)); |
|
|
vertices.push_back(ofVec2f((float)ofGetWidth() / 2.0f, margin)); |
|
@ -34,9 +42,9 @@ BaseSurface * SurfaceFactory::createSurface(int type){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return triangleSurface; |
|
|
return triangleSurface; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}else if(type == SurfaceType::QUAD_SURFACE){ |
|
|
QuadSurface * SurfaceFactory::createQuadSurface(){ |
|
|
|
|
|
|
|
|
vector <ofVec2f> vertices; |
|
|
vector <ofVec2f> vertices; |
|
|
float margin = 50.0f; |
|
|
float margin = 50.0f; |
|
|
vertices.push_back(ofVec2f(margin, margin)); |
|
|
vertices.push_back(ofVec2f(margin, margin)); |
|
@ -58,10 +66,6 @@ BaseSurface * SurfaceFactory::createSurface(int type){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return quadSurface; |
|
|
return quadSurface; |
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
throw runtime_error("Undefined surface type"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} // namespace piMapper
|
|
|
} // namespace piMapper
|
|
|