mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
New Egg API
This commit is contained in:
parent
35455f504b
commit
dd730b98ca
@ -643,7 +643,6 @@ bool MaxEggExpOptions::DoExport(IObjParam *ip, bool autoOverwrite, bool saveLog)
|
||||
char *apcParameters[64];
|
||||
char pszSF[10], pszEF[10];
|
||||
char acOutputFilename[MAX_PATH];
|
||||
char curFilename[MAX_PATH];
|
||||
int iParameterCount=0;
|
||||
|
||||
//Initialize our global error logger
|
||||
|
@ -338,7 +338,7 @@ void Logger::WriteToPipe( char *textToPipe )
|
||||
case PIPE_TO_FILE:
|
||||
if ( myFileOutputLog.is_open() )
|
||||
{
|
||||
for ( int i = 0; i < myHierarchyLevel; ++i )
|
||||
for (unsigned int i = 0; i < myHierarchyLevel; ++i )
|
||||
myFileOutputLog << " ";
|
||||
myFileOutputLog << textToPipe << endl;
|
||||
myFileOutputLog.flush();
|
||||
|
@ -413,7 +413,7 @@ convert_char_chan(double start_frame, double end_frame, double frame_inc,
|
||||
}
|
||||
|
||||
EggXfmSAnim *anim = _tree.get_egg_anim(node_desc);
|
||||
if (!anim->add_data(tgroup->get_transform())) {
|
||||
if (!anim->add_data(tgroup->get_transform3d())) {
|
||||
// *** log an error
|
||||
}
|
||||
delete tgroup;
|
||||
@ -528,21 +528,21 @@ process_model_node(MaxNodeDesc *node_desc) {
|
||||
break;
|
||||
|
||||
case SHAPE_CLASS_ID:
|
||||
if (state.obj->ClassID() == EDITABLE_SURF_CLASS_ID) {
|
||||
if (state.obj->ClassID() == EDITABLE_SURF_CLASS_ID) {
|
||||
Logger::Log( MTEC, Logger::SAT_HIGH_LEVEL,
|
||||
"Found a NURB object in the hierarchy!" );
|
||||
NURBSSet getSet;
|
||||
if (GetNURBSSet(state.obj, time, getSet, TRUE)) {
|
||||
NURBSObject *nObj = getSet.GetNURBSObject(0);
|
||||
if (nObj->GetType() == kNCVCurve) {
|
||||
//It's a CV Curve, process it
|
||||
NURBSSet getSet;
|
||||
if (GetNURBSSet(state.obj, time, getSet, TRUE)) {
|
||||
NURBSObject *nObj = getSet.GetNURBSObject(0);
|
||||
if (nObj->GetType() == kNCVCurve) {
|
||||
//It's a CV Curve, process it
|
||||
egg_group = _tree.get_egg_group(node_desc);
|
||||
get_transform(max_node, egg_group);
|
||||
make_nurbs_curve((NURBSCVCurve *)nObj, string(max_node->GetName()),
|
||||
time, egg_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
make_nurbs_curve((NURBSCVCurve *)nObj, string(max_node->GetName()),
|
||||
time, egg_group);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CAMERA_CLASS_ID:
|
||||
@ -781,7 +781,7 @@ get_transform(INode *max_node, EggGroup *egg_group) {
|
||||
// node's parent
|
||||
m4d = m4d * egg_group->get_node_frame_inv();
|
||||
if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) {
|
||||
egg_group->add_matrix(m4d);
|
||||
egg_group->add_matrix4(m4d);
|
||||
Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL,
|
||||
"Non-identity matrix applied to node!" );
|
||||
} else {
|
||||
@ -877,7 +877,7 @@ get_joint_transform(INode *max_node, EggGroup *egg_group) {
|
||||
// node's parent
|
||||
m4d = m4d * egg_group->get_node_frame_inv();
|
||||
if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) {
|
||||
egg_group->add_matrix(m4d);
|
||||
egg_group->add_matrix4(m4d);
|
||||
Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL,
|
||||
"Non-identity matrix applied to node!" );
|
||||
} else {
|
||||
@ -953,7 +953,7 @@ if (parent_node) {
|
||||
m4d = m4d * pi_m4d;
|
||||
}
|
||||
if (!m4d.almost_equal(LMatrix4d::ident_mat(), 0.0001)) {
|
||||
egg_group->add_matrix(m4d);
|
||||
egg_group->add_matrix4(m4d);
|
||||
Logger::Log( MNEG_GEOMETRY_GENERATION, Logger::SAT_DEBUG_SPAM_LEVEL,
|
||||
"Non-identity matrix applied to node!" );
|
||||
} else {
|
||||
@ -1600,14 +1600,14 @@ make_polyset(INode *max_node, Mesh *mesh,
|
||||
|
||||
LVector3d realNorm = ((points[1] - points[0]).cross(
|
||||
points[2] - points[0]));
|
||||
Point3 maxNormTemp = mesh->getFaceNormal(iFace);
|
||||
LVector3d maxNorm = (LVector3d(maxNormTemp.x, maxNormTemp.y, maxNormTemp.z) *
|
||||
vertex_frame);
|
||||
|
||||
if (realNorm.dot(maxNorm) < 0.0) {
|
||||
egg_poly->set_vertex(0, verts[2]);
|
||||
egg_poly->set_vertex(2, verts[0]);
|
||||
}
|
||||
Point3 maxNormTemp = mesh->getFaceNormal(iFace);
|
||||
LVector3d maxNorm = (LVector3d(maxNormTemp.x, maxNormTemp.y, maxNormTemp.z) *
|
||||
vertex_frame);
|
||||
|
||||
if (realNorm.dot(maxNorm) < 0.0) {
|
||||
egg_poly->set_vertex(0, verts[2]);
|
||||
egg_poly->set_vertex(2, verts[0]);
|
||||
}
|
||||
|
||||
// *** More shader stuff to ignore
|
||||
/*
|
||||
@ -1745,31 +1745,31 @@ get_vertex_weights(INode *max_node, EggVertexPool *vpool) {
|
||||
EggVertexPool::iterator vi;
|
||||
|
||||
if (mod) {
|
||||
// create a physique export interface
|
||||
IPhysiqueExport *pPhysiqueExport = (IPhysiqueExport *)mod->GetInterface(I_PHYINTERFACE);
|
||||
if (pPhysiqueExport) {
|
||||
// create a context export interface
|
||||
IPhyContextExport *pContextExport =
|
||||
(IPhyContextExport *)pPhysiqueExport->GetContextInterface(max_node);
|
||||
if (pContextExport) {
|
||||
// set the flags in the context export interface
|
||||
pContextExport->ConvertToRigid(TRUE);
|
||||
pContextExport->AllowBlending(TRUE);
|
||||
// create a physique export interface
|
||||
IPhysiqueExport *pPhysiqueExport = (IPhysiqueExport *)mod->GetInterface(I_PHYINTERFACE);
|
||||
if (pPhysiqueExport) {
|
||||
// create a context export interface
|
||||
IPhyContextExport *pContextExport =
|
||||
(IPhyContextExport *)pPhysiqueExport->GetContextInterface(max_node);
|
||||
if (pContextExport) {
|
||||
// set the flags in the context export interface
|
||||
pContextExport->ConvertToRigid(TRUE);
|
||||
pContextExport->AllowBlending(TRUE);
|
||||
|
||||
for (vi = vpool->begin(); vi != vpool->end(); ++vi) {
|
||||
EggVertex *vert = (*vi);
|
||||
int max_vi = vert->get_external_index();
|
||||
|
||||
// get the vertex export interface
|
||||
IPhyVertexExport *pVertexExport =
|
||||
(IPhyVertexExport *)pContextExport->GetVertexInterface(max_vi);
|
||||
if (pVertexExport) {
|
||||
int vertexType = pVertexExport->GetVertexType();
|
||||
|
||||
// handle the specific vertex type
|
||||
if(vertexType == RIGID_TYPE) {
|
||||
// typecast to rigid vertex
|
||||
IPhyRigidVertex *pTypeVertex = (IPhyRigidVertex *)pVertexExport;
|
||||
|
||||
// get the vertex export interface
|
||||
IPhyVertexExport *pVertexExport =
|
||||
(IPhyVertexExport *)pContextExport->GetVertexInterface(max_vi);
|
||||
if (pVertexExport) {
|
||||
int vertexType = pVertexExport->GetVertexType();
|
||||
|
||||
// handle the specific vertex type
|
||||
if(vertexType == RIGID_TYPE) {
|
||||
// typecast to rigid vertex
|
||||
IPhyRigidVertex *pTypeVertex = (IPhyRigidVertex *)pVertexExport;
|
||||
INode *bone_node = pTypeVertex->GetNode();
|
||||
MaxNodeDesc *joint_node_desc = _tree.find_joint(bone_node);
|
||||
if (joint_node_desc){
|
||||
@ -1780,10 +1780,10 @@ get_vertex_weights(INode *max_node, EggVertexPool *vpool) {
|
||||
Logger::Log( MTEC, Logger::SAT_MEDIUM_LEVEL, bone_node->GetName() );
|
||||
}
|
||||
}
|
||||
else if(vertexType == RIGID_BLENDED_TYPE) {
|
||||
// typecast to blended vertex
|
||||
IPhyBlendedRigidVertex *pTypeVertex = (IPhyBlendedRigidVertex *)pVertexExport;
|
||||
|
||||
else if(vertexType == RIGID_BLENDED_TYPE) {
|
||||
// typecast to blended vertex
|
||||
IPhyBlendedRigidVertex *pTypeVertex = (IPhyBlendedRigidVertex *)pVertexExport;
|
||||
|
||||
for (int ji = 0; ji < pTypeVertex->GetNumberNodes(); ++ji) {
|
||||
float weight = pTypeVertex->GetWeight(ji);
|
||||
if (weight > 0.0f) {
|
||||
@ -1804,11 +1804,11 @@ get_vertex_weights(INode *max_node, EggVertexPool *vpool) {
|
||||
}
|
||||
}
|
||||
//Release the context interface
|
||||
pPhysiqueExport->ReleaseContextInterface(pContextExport);
|
||||
}
|
||||
//Release the physique export interface
|
||||
mod->ReleaseInterface(I_PHYINTERFACE, pPhysiqueExport);
|
||||
}
|
||||
pPhysiqueExport->ReleaseContextInterface(pContextExport);
|
||||
}
|
||||
//Release the physique export interface
|
||||
mod->ReleaseInterface(I_PHYINTERFACE, pPhysiqueExport);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//No physique, try to find a skin
|
||||
|
@ -172,7 +172,7 @@ MaxEggJoint *MaxEggLoader::MakeJoint(EggGroup *joint, EggGroup *context)
|
||||
{
|
||||
MaxEggJoint *parent = FindJoint(context);
|
||||
MaxEggJoint *result = new MaxEggJoint;
|
||||
LMatrix4d t = joint->get_transform();
|
||||
LMatrix4d t = joint->get_transform3d();
|
||||
if (parent) {
|
||||
result->_trans = t * parent->_trans;
|
||||
} else {
|
||||
@ -575,7 +575,7 @@ void MaxEggLoader::TraverseEggNode(EggNode *node, EggGroup *context)
|
||||
EggTexture *tex = poly->get_texture(0);
|
||||
texid = GetTex(tex->get_fullpath().to_os_specific())->_id;
|
||||
if (tex->has_transform())
|
||||
uvtrans = tex->get_transform();
|
||||
uvtrans = tex->get_transform2d();
|
||||
} else {
|
||||
texid = GetTex("")->_id;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user