bugfixes, primitive clipping for cylinders
parent
19eb23b13f
commit
4a32ffedde
|
@ -331,7 +331,9 @@ void saveScene(QWidget *parent, SceneContext *ctx, const QString &targetFile) {
|
|||
QString textContent = doc.toString();
|
||||
QTextStream input(&textContent);
|
||||
QTextStream output(&file);
|
||||
QRegExp nameRegExp("name=\"[^\"]*\""),
|
||||
QRegExp
|
||||
filenameRegExp("filename=\"[^\"]*\""),
|
||||
nameRegExp("name=\"[^\"]*\""),
|
||||
tagRegExp("^\\s*<([a-zA-Z]+) "),
|
||||
leadingSpaces("^ *"),
|
||||
closeTag("^\\s*</");
|
||||
|
@ -362,8 +364,9 @@ void saveScene(QWidget *parent, SceneContext *ctx, const QString &targetFile) {
|
|||
int tagMatch = tagRegExp.indexIn(line),
|
||||
tagLength = tagRegExp.matchedLength();
|
||||
int nameMatch = nameRegExp.indexIn(line),
|
||||
filenameMatch = filenameRegExp.indexIn(line),
|
||||
nameLength = nameRegExp.matchedLength();
|
||||
if (tagMatch != -1 && nameMatch != -1) {
|
||||
if (tagMatch != -1 && nameMatch != -1 && filenameMatch == -1) {
|
||||
line = line.left(tagLength) + line.mid(nameMatch, nameLength) + " "
|
||||
+ line.mid(tagMatch+tagLength, nameMatch-(tagMatch+tagLength))
|
||||
+ line.mid(nameMatch+nameLength);
|
||||
|
|
|
@ -166,11 +166,11 @@ public:
|
|||
AABB getAABB() const {
|
||||
return getAABB(0, m_length);
|
||||
}
|
||||
/*
|
||||
AABB getClippedAABB(const AABB &aabb) const {
|
||||
|
||||
AABB getClippedAABB(const AABB &box) const {
|
||||
Float nearT, farT;
|
||||
AABB result(m_aabb);
|
||||
result.clip(aabb);
|
||||
AABB result(getAABB(0, m_length));
|
||||
result.clip(box);
|
||||
|
||||
Point a = m_objectToWorld(Point(0, 0, 0));
|
||||
Point b = m_objectToWorld(Point(0, 0, m_length));
|
||||
|
@ -180,12 +180,11 @@ public:
|
|||
|
||||
nearT = std::max(nearT, (Float) 0);
|
||||
farT = std::min(farT, m_length);
|
||||
result = getWorldAABB(nearT, farT);
|
||||
result.clip(aabb);
|
||||
result = getAABB(nearT, farT);
|
||||
result.clip(box);
|
||||
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
Float getSurfaceArea() const {
|
||||
return 2*M_PI*m_radius*m_length;
|
||||
|
|
Loading…
Reference in New Issue