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