mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
add egg-vertex-membership-quantize
This commit is contained in:
parent
c6cc36e604
commit
de346aa4d1
@ -169,6 +169,14 @@ ConfigVariableBool egg_preload_simple_textures
|
||||
"fact, the egg loader will generate simple texture images if "
|
||||
"either this or preload-simple-textures is true."));
|
||||
|
||||
ConfigVariableDouble egg_vertex_membership_quantize
|
||||
("egg-vertex-membership-quantize", 0.01,
|
||||
PRC_DESC("Specifies the nearest amount to round each vertex joint "
|
||||
"membership value when loading an egg file. This affects animated "
|
||||
"egg files only. There is a substantial runtime "
|
||||
"performance advantage for reducing trivial differences in joint "
|
||||
"membership. Set this to 0 to leave joint membership as it is."));
|
||||
|
||||
ConfigureFn(config_egg2pg) {
|
||||
init_libegg2pg();
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ extern EXPCL_PANDAEGG ConfigVariableInt egg_max_vertices;
|
||||
extern EXPCL_PANDAEGG ConfigVariableInt egg_max_indices;
|
||||
extern EXPCL_PANDAEGG ConfigVariableBool egg_emulate_bface;
|
||||
extern EXPCL_PANDAEGG ConfigVariableBool egg_preload_simple_textures;
|
||||
extern EXPCL_PANDAEGG ConfigVariableDouble egg_vertex_membership_quantize;
|
||||
|
||||
extern EXPCL_PANDAEGG void init_libegg2pg();
|
||||
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "thread.h"
|
||||
#include "uvScrollNode.h"
|
||||
#include "textureStagePool.h"
|
||||
#include "cmath.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <algorithm>
|
||||
@ -2487,10 +2488,14 @@ make_vertex_data(const EggRenderState *render_state,
|
||||
} else {
|
||||
// If the vertex does have an explicit membership, ignore its
|
||||
// parentage and assign it where it wants to be.
|
||||
double quantize = egg_vertex_membership_quantize;
|
||||
EggVertex::GroupRef::const_iterator gri;
|
||||
for (gri = vertex->gref_begin(); gri != vertex->gref_end(); ++gri) {
|
||||
EggGroup *egg_joint = (*gri);
|
||||
double membership = egg_joint->get_vertex_membership(vertex);
|
||||
if (quantize != 0.0) {
|
||||
membership = cfloor(membership / quantize + 0.5) * quantize;
|
||||
}
|
||||
|
||||
PT(VertexTransform) vt = character_maker->egg_to_transform(egg_joint);
|
||||
nassertr(vt != (VertexTransform *)NULL, vertex_data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user