使用以前在ios应用程序中使用的mtl + obj文件将3d pcb芯片加载到场景中。
使用three.js (r80)加载时,对象加载并且几何图形看起来正确,但没有纹理,颜色或图像加载到对象上。我做错了吗?
mtl文件中引用的所有图像都与mtl + obj文件位于同一目录中,我看到它们被请求并正确地提供给浏览器。
在Blender中加载,它具有正确的颜色,但不会将图像投影到对象上:
JS代码我使用:
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, OnMarkerClickListener {
private Marker myMarker;
FirebaseDatabase firebaseDatabase = FirebaseDatabase.getInstance();
DatabaseReference mProfileRef = firebaseDatabase.getReference();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
protected void onStart(){
super.onStart();
mProfileRef.child("Profile").addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
for (DataSnapshot child : dataSnapshot.child("0").getChildren()){
String dob = child.child("dob").getValue().toString();
String dod = child.child("dod").getValue().toString();
String latitude = child.child("latitude").getValue().toString();
String longitude = child.child("longitude").getValue().toString();
String firstname = child.child("firstname").getValue().toString();
String lastname = child.child("lastname").getValue().toString();
LatLng location = new LatLng(latitude,longitude);
googleMap.addMarker(new MarkerOptions().position(location).title(firstname,lastname).snippet(dob,dod));
}
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
@Override
public void onMapReady(GoogleMap googleMap) {
googleMap.setOnMarkerClickListener(this);
LatLng wollongong = new LatLng(-34.404336, 150.881632);
myMarker = googleMap.addMarker(new MarkerOptions()
.position(wollongong)
.title("Ben Roberts")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker))
.snippet("05/06/1949 - 08/08/2016")
.anchor(0.0f,1.0f )
);
LatLng test2 = new LatLng(-34.404464, 150.881892);
googleMap.addMarker(new MarkerOptions()
.position(test2)
.title("Graveyard")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker))
.snippet("This is a test graveyard too")
.anchor(0.0f,1.0f )
);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(wollongong, 18));
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
googleMap.setMyLocationEnabled(true);
}
@Override
public boolean onMarkerClick(Marker marker) {
if (marker.equals(myMarker))
{
Intent intent = new Intent(MapsActivity.this,Info_window.class);
startActivity(intent);
}
else
{
Intent intent = new Intent(MapsActivity.this,Info_window.class);
startActivity(intent);
}
return false;
}
答案 0 :(得分:0)
您是否尝试过在场景中添加一些灯光?