Giter VIP home page Giter VIP logo

Comments (7)

sy-project avatar sy-project commented on June 12, 2024 1

https://drive.google.com/file/d/10V5zb2WtRJb15RkIp7Xxs9Cu0tyEI-xR/view?usp=sharing

obj file is here.
this file is 79.6mb, so I used google drive.

from assimp.

tellypresence avatar tellypresence commented on June 12, 2024

Please attach offending .obj file to ticket for troubleshooting

from assimp.

kimkulling avatar kimkulling commented on June 12, 2024

Do you have a call stack?

from assimp.

turol avatar turol commented on June 12, 2024

Can be correctly loaded with assimp info and converted to .fbx with assimp export. No errors with Valgrind.

Error is most likely in your code.

from assimp.

tellypresence avatar tellypresence commented on June 12, 2024

Model loads and renders OK for me, agree problem likely in custom implementation code

(Also, it is expected that index numbers are all over the place, if they were perfectly linear the scene would render nonsense...the vertices, which might be at any location in the sequence, are referenced via index to create the faces)

ViewpointScreenshot
Exterior
Roof aperture
Upper level
Ground level

from assimp.

sy-project avatar sy-project commented on June 12, 2024

facedata.txt

    for (int meshnum = 0; meshnum < scene->mNumMeshes; meshnum++)
    {
        auto scene_mesh = scene->mMeshes;
        string fileoutputdata = "MeshNum[" + to_string(meshnum) + "]\n";
        string temp = "";
        //this code has problem
        for (unsigned int facenum = 0; facenum < scene_mesh[meshnum]->mNumFaces; ++facenum)
        {
            auto face = scene_mesh[meshnum]->mFaces[facenum];
            if (face.mNumIndices == 3) {
                Triangle triangle;
                triangle.v[0] = face.mIndices[0];
                triangle.v[1] = face.mIndices[1];
                triangle.v[2] = face.mIndices[2];
                for (int i = 0; i < 3; i++)
                {
                    temp += to_string(triangle.v[i]);
                    temp += "/";
                }
                Triangle_ArrayList_add(&mesh->triangles, &triangle);
                temp += "\n";
            }
        }
        temp += "\n";
        ofstream file;
        file.open("facedata.txt", ios::app);
        if (file.is_open())
        {
            file.write(fileoutputdata.c_str(), fileoutputdata.size());
            file.write(temp.c_str(), temp.size());
            file.close();
        }
    }

I wrote the code like this, and the data for that code is like the attached file above. I checked that it comes out normally visually, but I don't think I can bring the data of face in order. What should I do?

from assimp.

sy-project avatar sy-project commented on June 12, 2024

I solved Triangle Order Problem.
But I saw new problem. I think this problem caused a previous problem.

When the assimp library imports the model, it also imports the vertex data that is not in the model.

Assimp_Vertexdata.txt
OBJ_origin_Vertexdata.txt

Export Assimp Data Func

	for (int meshnum = 0; meshnum < scene->mNumMeshes; meshnum++)
	{
		auto scene_mesh = scene->mMeshes;
		string output = "Mesh[" + to_string(meshnum) + "]\n";
		string temp = "";
		//Vertex Data
		for (int vertexnum = 0; vertexnum < scene_mesh[meshnum]->mNumVertices; vertexnum++)
		{
			Vector3 vertex;
			vertex.x = scene_mesh[meshnum]->mVertices[vertexnum].x;
			vertex.y = scene_mesh[meshnum]->mVertices[vertexnum].y;
			vertex.z = scene_mesh[meshnum]->mVertices[vertexnum].z;
			temp += "x[" + to_string(vertex.x) + "] y[" + to_string(vertex.y) + "] z[" + to_string(vertex.z) + "]\n";
			Vector3_ArrayList_add(&vertices, &vertex);
		}
		ofstream file;
		file.open("importer_vertexdata.txt", ios::app);
		if (file.is_open())
		{
			file.write(output.c_str(), output.size());
			file.write(temp.c_str(), temp.size());
			file.close();
		}
        }

Origin Data Export Func

	while (fgets(current_line, 500, file))
	{
		current_token = strtok(current_line, " \t\n\r");

		if (current_token == NULL)
		{
			continue;
		}

		else if (strequal(current_token, "v"))
		{
			Vector3 vertex;
			vertex.x = atof(strtok(NULL, WHITESPACE));
			vertex.y = atof(strtok(NULL, WHITESPACE));
			vertex.z = atof(strtok(NULL, WHITESPACE));
			string temp = "x[" + to_string(vertex.x) + "] y[" + to_string(vertex.y) + "] z[" + to_string(vertex.z) + "]\n";
			ofstream file;
			file.open("origin_vertexdata.txt", ios::app);
			if (file.is_open())
			{
				file.write(temp.c_str(), temp.size());
				file.close();
			}
			Vector3_ArrayList_add(&vertices, &vertex);
		}
    }

from assimp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.