I am a beginner of panda3D and want to create egg files in the program through c++ code, but there is no relevant tutorial, and I don’t know what library to import…
Here is a code I wrote to create an egg file, but the compiler reported LNK2001, what is the problem? Any help would be appreciated.
//#include "asyncTaskManager.h"
//#include <genericAsyncTask.h>
//
//#include "pandaFramework.h"
//#include "pandaSystem.h"
//
//#include <eggWriter.h>
//#include <eggPolygon.h>
//#include <eggVertexPool.h>
//#include <eggData.h>
//#include <eggVertex.h>
//#include <eggPrimitive.h>
//#include <eggNode.h>
//#include <eggGroupNode.h>
//#include <eggPolygon.h>
//#include <eggCoordinateSystem.h>
//#include <geomVertexReader.h>
//
//#include "eggWriter.h"
//#include "eggPolygon.h"
//#include "eggVertexPool.h"
//#include <eggData.h>
//#include "eggVertex.h"
//#include <eggPrimitive.h>
//#include <eggNode.h>
#include <eggGroupNode.h>
#include <eggPolygon.h>
#include <eggCoordinateSystem.h>
#include <geomVertexReader.h>
#include <fstream>
#include <iostream>
#include <string>
#include <iostream>
#include <cstdlib>
using namespace std;
void makeWedgeStart(EggData d);
EggData makeWedge();
void makeWedgeStart(EggData d) {
EggData data = d;
data.write_egg("20221109.egg");
}
EggData makeWedge() {
EggCoordinateSystem z_u = EggCoordinateSystem();
z_u.set_value(CS_zup_right);
EggNode* z_up = &z_u;
EggData data = EggData();
data.add_child(z_up);
// create vertex
EggVertexPool v = EggVertexPool("fan");
EggNode* vp = &v;
data.add_child(vp);
EggVertex v0 = EggVertex();
LPoint3d point0 = LPoint3d(1, 1, 1);
v0.set_pos(point0);
EggVertex v1 = EggVertex();
LPoint3d point1 = LPoint3d(-1, 1, 1);
v1.set_pos(point1);
EggVertex v2 = EggVertex();
LPoint3d point2 = LPoint3d(-1, -1, 1);
v2.set_pos(point2);
EggVertex v3 = EggVertex();
LPoint3d point3 = LPoint3d(1, -1, 1);
v3.set_pos(point3);
EggVertex v4 = EggVertex();
LPoint3d point4 = LPoint3d(1, -1, -1);
v4.set_pos(point4);
EggVertex v5 = EggVertex();
LPoint3d point5 = LPoint3d(-1, -1, -1);
v5.set_pos(point5);
EggVertex v6 = EggVertex();
LPoint3d point6 = LPoint3d(-1, 1, -1);
v6.set_pos(point6);
EggVertex v7 = EggVertex();
LPoint3d point7 = LPoint3d(1, 1, -1);
v7.set_pos(point7);
// create triangle
EggPolygon pol1 = EggPolygon();
EggNode* poly1 = &pol1;
data.add_child(poly1);
pol1.add_vertex(&v3);
pol1.add_vertex(&v2);
pol1.add_vertex(&v4);
EggPolygon pol2 = EggPolygon();
EggNode* poly2 = &pol2;
data.add_child(poly2);
pol2.add_vertex(&v4);
pol2.add_vertex(&v2);
pol2.add_vertex(&v5);
EggPolygon pol3 = EggPolygon();
EggNode* poly3 = &pol3;
data.add_child(poly3);
pol3.add_vertex(&v1);
pol3.add_vertex(&v0);
pol3.add_vertex(&v6);
EggPolygon pol4 = EggPolygon();
EggNode* poly4 = &pol4;
data.add_child(poly4);
pol4.add_vertex(&v6);
pol4.add_vertex(&v0);
pol4.add_vertex(&v7);
EggPolygon pol5 = EggPolygon();
EggNode* poly5 = &pol5;
data.add_child(poly5);
pol5.add_vertex(&v6);
pol5.add_vertex(&v5);
pol5.add_vertex(&v1);
EggPolygon pol6 = EggPolygon();
EggNode* poly6 = &pol6;
data.add_child(poly6);
pol6.add_vertex(&v1);
pol6.add_vertex(&v5);
pol6.add_vertex(&v2);
EggPolygon pol7 = EggPolygon();
EggNode* poly7 = &pol7;
data.add_child(poly7);
pol7.add_vertex(&v1);
pol7.add_vertex(&v2);
pol7.add_vertex(&v0);
EggPolygon pol8 = EggPolygon();
EggNode* poly8 = &pol8;
data.add_child(poly8);
pol8.add_vertex(&v0);
pol8.add_vertex(&v2);
pol8.add_vertex(&v2);
EggPolygon pol9 = EggPolygon();
EggNode* poly9 = &pol9;
data.add_child(poly9);
pol9.add_vertex(&v0);
pol9.add_vertex(&v3);
pol9.add_vertex(&v7);
EggPolygon pol10 = EggPolygon();
EggNode* poly10 = &pol10;
data.add_child(poly10);
pol10.add_vertex(&v7);
pol10.add_vertex(&v3);
pol10.add_vertex(&v4);
EggPolygon pol11 = EggPolygon();
EggNode* poly11 = &pol11;
data.add_child(poly11);
pol11.add_vertex(&v7);
pol11.add_vertex(&v4);
pol11.add_vertex(&v6);
EggPolygon pol12 = EggPolygon();
EggNode* poly12 = &pol12;
data.add_child(poly12);
pol12.add_vertex(&v6);
pol12.add_vertex(&v4);
pol12.add_vertex(&v5);
return data;
}
int main(int argc, char* argv[]) {
EggData data = makeWedge();
makeWedgeStart(data);
return 0;
}
Thanks!