【发布时间】:2021-11-06 23:59:32
【问题描述】:
我在搅拌机中创建了一个简单的单位大小的平面并将其导出到 .obj 文件中,内容是这样的
# Blender v2.93.3 OBJ File: ''
# www.blender.org
mtllib plane.mtl
o Plane
v 1.000000 -1.000000 0.000000
v -1.000000 -1.000000 0.000000
v 1.000000 1.000000 0.000000
v -1.000000 1.000000 0.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vn 0.0000 0.0000 -1.0000
usemtl None
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
当我用 assimp 导入它时
unsigned flags = aiProcess_Triangulate | aiProcess_OptimizeMeshes |
aiProcess_JoinIdenticalVertices | aiProcess_SortByPType |
aiProcess_CalcTangentSpace /*|aiProcess_FlipWindingOrder*/;
const aiScene * scene = importer.ReadFile(path, flags);
for (int i = 0; i < scene->mNumMeshes; ++i)
{
const aiMesh * mesh = scene->mMeshes[i];
for (int j = 0; j < mesh->mNumVertices; ++j)
{
const aiVector3D & vertex = mesh->mVertices[j];
model->vertices.emplace_back(vertex.x, vertex.y, vertex.z);
// ...
它给了我奇怪的结果
x = {double} -0.007812501848093234
y = {double} -0.0078125
z = {double} 1.5873523201947252E-314
x = {double} 0.0078125055733835325
y = {double} 0.0078125
z = {double} 5.2635442471208903E-315
x = {double} 2.1053526862322168E-314
y = {double} -3.0421935264696467E-310
z = {double} 0
x = {double} 0
y = {double} 0
z = {double} 0
我期望值从 1 到 -1,就像它们在 .obj 文件中一样
我也试过传0而不是flags,结果是一样的
【问题讨论】: