Beispiel #1
0
AS3_Val cloneMesh( void * self, AS3_Val args )
{
	Mesh* src, *mesh;

	Material* material;

	Texture* texture;

	int render_mode, i;

	Vector3D** vp;

	AS3_ArrayValue( args, "PtrType, PtrType, PtrType, IntType",& src, & material, & texture, & render_mode);

	mesh = mesh_clone(src, material, texture, render_mode);

	if( ( vp = ( Vector3D * *   )malloc( sizeof( Vector3D * ) * mesh -> nVertices ) ) == NULL )
	{
		return AS3_Array( "PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType",
							mesh,
							& mesh->lightEnable,
							& mesh->fogEnable,
							& mesh->useMipmap,
							//& mesh->terrainTrace,
							& mesh->mip_dist,
							& mesh->v_dirty, 
							& mesh->octree_depth,
							& mesh->addressMode,
							& mesh->texTransform->rotation,
							mesh->texTransform->offset,
							mesh->texTransform->scale,
							& mesh->texTransformDirty,
							& mesh->hit,
							& mesh->skinMeshController);
	}

	for( i = 0; i < mesh -> nVertices; i ++ )
	{
		vp[i] = mesh -> vertices[i]->position;
	}

	return AS3_Array( "PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType, PtrType",
						mesh,
						& mesh->lightEnable,
						& mesh->fogEnable,
						& mesh->useMipmap,
						//& mesh->terrainTrace,
						& mesh->mip_dist,
						& mesh->v_dirty,
						& mesh->octree_depth,
						& mesh->addressMode,
						& mesh->texTransform->rotation, 
						mesh->texTransform->offset,
						mesh->texTransform->scale,
						& mesh->texTransformDirty,
						& mesh->hit,
						& mesh->skinMeshController,
						& vp );
}
Beispiel #2
0
static void build_shape_nld(GF_Node *n, Drawable3D *stack, GF_TraverseState *tr_state)
{
	M_NonLinearDeformer *nld = (M_NonLinearDeformer*)n;
	Drawable3D *geo_st = (Drawable3D *)gf_node_get_private(nld->geometry);

	if (!nld->geometry) return;
	if (!geo_st) return;

	mesh_clone(stack->mesh, geo_st->mesh);
	/*apply deforms*/
	NLD_Apply(nld, stack->mesh);
}