我使用assimp加载3D模型。 我的模型具有嵌入式纹理(“我猜”)。但是我有两个问题:
我什至无法打印纹理的宽度或高度。
打印<div class="card__image"></div>
,我得到的是常用格式texturefile
,依此类推。
但是当我尝试打印*0 *1
时,什么也没得到……与纹理pcData相同。
代码如下:
scene->mTextures[atoi(texturefile.C_Str())]->mFileName
答案 0 :(得分:0)
与最新的母版一起使用时,以下代码将为您工作:
parameter<string> SourceDir := '%SourceDataDir%/OV/GTFS_20190318';
container write_to_fss
{
unit<uint32> trip
: StorageName = "=SourceDir + '/trips.csv'"
, StorageType = "gdal.vect"
, StorageReadOnly = "True";
unit<uint32> name := SubItem_PropValues(trip,'name');
unit<uint32> fssdomain := trip;
container to_fss_domain : StorageName = "=SourceDir + '/trip_domain.fss'"
{
unit<uint32> domain := fssdomain;
}
container to_fss :=
for_each_nedv(
name/name
, 'trip/' + name/name
, to_fss_domain/domain
, string
)
, StorageName = "=SourceDir + '/trip.fss'";
}
container readdomain
: StorageName = "=SourceDir + '/trip_domain.fss'"
, StorageReadOnly = "True"
{
unit<uint32> domain;
}
container trip :=
for_each_ndv(
write_to_fss/name/name
, readdomain/domain
, string)
, StorageName = "=SourceDir + '/trip.fss'"
, StorageReadOnly = "True"
{
unit<uint32> domain := readdomain/domain;
}
在旧版本中,您必须寻找特殊的令牌:
aiMaterial material = scene->mMaterials[index];
aiString texture_file;
material->Get(AI_MATKEY_TEXTURE(aiTextureType_DIFFUSE, 0), texture_file);
if(auto texture = scene->GetEmbeddedTexture(texture_file.C_Str())) {
//returned pointer is not null, read texture from memory
} else {
//regular file, check if it exists and read it
}
希望有助于理解这一概念。