Skip to content

Commit

Permalink
lptm reading and writing bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Nov 11, 2022
1 parent 458e7c4 commit 56056ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions relight-cli/rtibuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,8 @@ size_t RtiBuilder::savePTM(const std::string &output) {

for(size_t i = 0; i < gbias.size(); i++) {
int j = coeffRemap[i];
gbias[i] = static_cast<int>(bias[j*3]*255.0);
gscale[i] = scale[j*3];
gbias[i] = static_cast<int>(bias[j+3]*255.0);
gscale[i] = scale[j+3];
}
for(float s: gscale)
stream << s << " ";
Expand Down
4 changes: 3 additions & 1 deletion src/legacy_rti.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ bool getFloats(FILE *file, vector<float> &a, unsigned int expected = 0) {
buffer[255] = 0;

QString str = buffer;
//some rtis have a space after the last float, other a \n directly.
str = str.trimmed();
QStringList parts = str.split(' ');
parts.pop_back(); //remove \n

for(int i = 0; i < parts.size(); i++) {
bool ok;
float s = parts[i].toDouble(&ok);
Expand Down

0 comments on commit 56056ec

Please sign in to comment.