JD2022-TU1/main/extern/Camcam/DLLInc/CCMesh.h

147 lines
No EOL
3.2 KiB
C++

// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the CCMESH_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// CCMESH_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifndef ___CCMESH_H___
#define ___CCMESH_H___
/************************************/
#include "CCMath.h"
#include "CCMap.h"
#include "stdio.h"
#include "IO_Defs.h"
//#define CCMESH_DLL_MODE
#ifdef CCMESH_DLL_MODE
#ifdef CCMESH_EXPORTS
#define CCMESH_API __declspec(dllexport)
#else
#define CCMESH_API __declspec(dllimport)
#endif
#else
#define CCMESH_API
#endif
#define MAX_POINT 5000
typedef struct FaceIndex_
{
int I[3];
} FaceIndex;
typedef struct Ponderation_
{
u32 VIndex;
f32 Weight;
} Ponderation;
typedef struct Skin_
{
MATRIX Flash;
u32 ObjectID;
u32 ObjectIndex;
u32 WeightNumber;
Ponderation *WeightList;
} Skin;
typedef struct Morphing_
{
u32 VIndex;
Vector Move;
} Morphing;
typedef struct Target_
{
float Weight;
u32 MorphNumber;
Morphing *MorphList;
u32 MorphNumber_UV;
Morphing *MorphList_UV;
} Target;
typedef struct CollideReport_
{
u32 FaceIndex;
Vector Ponderation;
} CollideReport;
class CCMESH_API Mesh
{
public:
Vector *Points;
Vector *PointsUV;
Vector *PointsUV2;
Vector *PointsN;
u32 *VertexColors;
Vector BVMin;
Vector BVMax;
FaceIndex *Indexes;
FaceIndex *Indexes_UV;
FaceIndex *Indexes_UV2;
FaceIndex *NeightBIndexes;
u32 ulNumberOfSubObjects;
u32 *FaceSubObjectIndexes;
u32 ulNumberOfSkins;
Skin *MeshSkin;
u32 ulNumberOfTarget;
Target *MorphTargets;
/* This is the topologic equality base. Use it when compute thing on 3D (skinning, morphing ...)*/
u32 UVAreUnic;
u32 Point3DEqualityNumber;
u32 *Point3DEqualityBase;
u32 NumberOfPoints;
u32 NumberOfPointsN;
u32 NumberOfPointsVertexColors;
u32 NumberOfFaces;
u32 NumberOfPointsUV;
u32 NumberOfPointsUV2;
Mesh();
void Destroy();
void SwapUV();
void Vertex(float X,float Y,float Z);
void VertexUV(float X,float Y,float Z);
void VertexN(float X,float Y,float Z);
void Face(int A,int B , int C);
void Face(int A,int B , int C, int D);
void FaceUV(int A,int B , int C,int UA,int UB , int UC,int MatIndex = 0);
void FaceUV4(int A,int B , int C, int D,int UA,int UB , int UC, int UD);
void ComputeBV();
void BVIfy();
void Tranform(MATRIX *Tr, MAP *RefMap);
void Connect();
int Collide(Vector &V, MAP *RefMap,CollideReport *pOptCol = 0);
void SetFace(int FaceIndex, int A,int B , int C, int MatIndex = 0);
void SetVertex(int VectorIndex, Vector *pXYZ,Vector *pUV,Vector *pNormale);
///// Render Data
MATRIX MatrixSrc;
float Focale;
void Render(MAP &SOURCEMAP, u32 Color , u32 inside, u32 Render);
Vector MATCHMAX;
Vector MATCHMIN;
void UpdateTopologie();
void Optimize();
void CompressSubObjects();
};
u32 CCMESH_API LoadObj(Mesh *LoadMesh,FILE *F);
void CCMESH_API BuildHead(Mesh *MyFace);
void CCMESH_API BuildPlane(Mesh *MyFace);
DECLARE_IO_H(Mesh, CCMESH_API);
#endif