kopia lustrzana https://github.com/OpenDroneMap/WebODM
Support for geo MTL texture files
rodzic
ff19222b66
commit
e6de64033e
|
@ -170,6 +170,9 @@ class ModelView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
objFilePath(cb){
|
objFilePath(cb){
|
||||||
|
// Mostly for backward compatibility
|
||||||
|
// as newer versions of ODM do not have
|
||||||
|
// a odm_textured_model.obj
|
||||||
const geoUrl = this.texturedModelDirectoryPath() + 'odm_textured_model_geo.obj';
|
const geoUrl = this.texturedModelDirectoryPath() + 'odm_textured_model_geo.obj';
|
||||||
const nongeoUrl = this.texturedModelDirectoryPath() + 'odm_textured_model.obj';
|
const nongeoUrl = this.texturedModelDirectoryPath() + 'odm_textured_model.obj';
|
||||||
|
|
||||||
|
@ -183,9 +186,20 @@ class ModelView extends React.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
mtlFilename(){
|
mtlFilename(cb){
|
||||||
// For some reason, loading odm_textured_model_geo.mtl does not load textures properly
|
// Mostly for backward compatibility
|
||||||
return 'odm_textured_model.mtl';
|
// as newer versions of ODM do not have
|
||||||
|
// a odm_textured_model.mtl
|
||||||
|
const geoUrl = this.texturedModelDirectoryPath() + 'odm_textured_model_geo.mtl';
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "HEAD",
|
||||||
|
url: geoUrl
|
||||||
|
}).done(() => {
|
||||||
|
cb("odm_textured_model_geo.mtl");
|
||||||
|
}).fail(() => {
|
||||||
|
cb("odm_textured_model.mtl");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -411,24 +425,26 @@ class ModelView extends React.Component {
|
||||||
const mtlLoader = new THREE.MTLLoader();
|
const mtlLoader = new THREE.MTLLoader();
|
||||||
mtlLoader.setPath(this.texturedModelDirectoryPath());
|
mtlLoader.setPath(this.texturedModelDirectoryPath());
|
||||||
|
|
||||||
mtlLoader.load(this.mtlFilename(), (materials) => {
|
this.mtlFilename(mtlPath => {
|
||||||
materials.preload();
|
mtlLoader.load(mtlPath, (materials) => {
|
||||||
|
materials.preload();
|
||||||
const objLoader = new THREE.OBJLoader();
|
|
||||||
objLoader.setMaterials(materials);
|
const objLoader = new THREE.OBJLoader();
|
||||||
this.objFilePath(filePath => {
|
objLoader.setMaterials(materials);
|
||||||
objLoader.load(filePath, (object) => {
|
this.objFilePath(filePath => {
|
||||||
this.loadGeoreferencingOffset((offset) => {
|
objLoader.load(filePath, (object) => {
|
||||||
object.translateX(offset.x);
|
this.loadGeoreferencingOffset((offset) => {
|
||||||
object.translateY(offset.y);
|
object.translateX(offset.x);
|
||||||
|
object.translateY(offset.y);
|
||||||
viewer.scene.scene.add(object);
|
|
||||||
|
viewer.scene.scene.add(object);
|
||||||
this.modelReference = object;
|
|
||||||
this.setPointCloudsVisible(false);
|
this.modelReference = object;
|
||||||
|
this.setPointCloudsVisible(false);
|
||||||
this.setState({
|
|
||||||
initializingModel: false,
|
this.setState({
|
||||||
|
initializingModel: false,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue