Advertisement
AlwaysGeeky

QubicleBinary.h

Oct 4th, 2014
1,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.54 KB | None | 0 0
  1. // ******************************************************************************
  2. //
  3. // Filename:    QubicleBinary.h
  4. // Project: Vox
  5. // Author:  Steven Ball
  6. //
  7. // Purpose:
  8. //
  9. // Revision History:
  10. //   Initial Revision - 10/07/14
  11. //
  12. // Copyright (c) 2005-2014, Steven Ball
  13. //
  14. // ******************************************************************************
  15.  
  16. #pragma once
  17.  
  18. #include "engine.h"
  19.  
  20. #include "MS3DModel.h"
  21. #include "MS3DAnimator.h"
  22.  
  23. class VoxelCharacter;
  24.  
  25. enum MergedSide
  26. {
  27.     MergedSide_None = 0,
  28.  
  29.     MergedSide_X_Positive = 1,
  30.     MergedSide_X_Negative = 2,
  31.     MergedSide_Y_Positive = 4,
  32.     MergedSide_Y_Negative = 8,
  33.     MergedSide_Z_Positive = 16,
  34.     MergedSide_Z_Negative = 32,
  35. };
  36.  
  37. bool IsMergedXNegative(int ***merged, int x, int y, int z);
  38. bool IsMergedXPositive(int ***merged, int x, int y, int z);
  39. bool IsMergedYNegative(int ***merged, int x, int y, int z);
  40. bool IsMergedYPositive(int ***merged, int x, int y, int z);
  41. bool IsMergedZNegative(int ***merged, int x, int y, int z);
  42. bool IsMergedZPositive(int ***merged, int x, int y, int z);
  43.  
  44. class QubicleMatrix
  45. {
  46. public:
  47.     char m_nameLength;
  48.     char* m_name;
  49.  
  50.     unsigned int m_matrixSizeX;
  51.     unsigned int m_matrixSizeY;
  52.     unsigned int m_matrixSizeZ;
  53.  
  54.     int m_matrixPosX;
  55.     int m_matrixPosY;
  56.     int m_matrixPosZ;
  57.  
  58.     unsigned int ***m_pColour;
  59.  
  60.     int m_boneIndex;
  61.  
  62.     Matrix4x4 m_modelMatrix;
  63.  
  64.     float m_scale;
  65.     float m_offsetX;
  66.     float m_offsetY;
  67.     float m_offsetZ;
  68.  
  69.     unsigned int m_meshID;
  70. };
  71.  
  72. class QubicleBinary
  73. {
  74. public:
  75.     /* Public methods */
  76.     QubicleBinary(OpenGLRenderer* pRenderer);
  77.     ~QubicleBinary();
  78.  
  79.     void Unload();
  80.  
  81.     void Reset();
  82.  
  83.     unsigned int GetMaterial();
  84.  
  85.     Matrix4x4 GetModelMatrix(int qubicleMatrixIndex);
  86.  
  87.     int GetMatrixIndexForName(const char* matrixName);
  88.     void GetMatrixPosition(int index, int* aX, int* aY, int* aZ);
  89.  
  90.     bool Import(const char* fileName);
  91.  
  92.     void GetColour(int matrixIndex, int x, int y, int z, float* r, float* g, float* b, float* a);
  93.     unsigned int GetColourCompact(int matrixIndex, int x, int y, int z);
  94.     bool GetActive(int matrixIndex, int x, int y, int z);
  95.  
  96.     void CreateMesh();
  97.     void UpdateMergedSide(int ***merged, int matrixIndex, int blockx, int blocky, int blockz, Vector3d *p1, Vector3d *p2, Vector3d *p3, Vector3d *p4, int startX, int startY, int maxX, int maxY, bool positive, bool zFace, bool xFace, bool yFace);
  98.  
  99.     int GetNumMatrices();
  100.     QubicleMatrix* GetQubicleMatrix(int index);
  101.     const char* GetMatrixName(int index);
  102.     float GetMatrixScale(int index);
  103.     Vector3d GetMatrixOffset(int index);
  104.  
  105.     void SetupMatrixBones(MS3DAnimator* pSkeleton);
  106.    
  107.     void SetScaleAndOffsetForMatrix(const char* matrixName, float scale, float xOffset, float yOffset, float zOffset);
  108.     float GetScale(const char* matrixName);
  109.     Vector3d GetOffset(const char* matrixName);
  110.  
  111.     void SetWireFrameRender(bool wireframe);
  112.  
  113.     void Update(float dt);
  114.  
  115.     void Render(bool renderOutline, bool refelction);
  116.  
  117. protected:
  118.     /* Protected methods */
  119.  
  120. private:
  121.     /* Private methods */
  122.  
  123. public:
  124.     /* Public members */
  125.     static const float BLOCK_RENDER_SIZE;
  126.  
  127. protected:
  128.     /* Protected members */
  129.  
  130. private:
  131.     /* Private members */
  132.     OpenGLRenderer* m_pRenderer;
  133.  
  134.     // Loaded flag
  135.     bool m_loaded;
  136.  
  137.     // Qubicle binary file information
  138.     char m_version[4];
  139.     unsigned int m_colourFormat;
  140.     unsigned int m_zAxisOrientation;
  141.     unsigned int m_compressed;
  142.     unsigned int m_visibilityMaskEncoded;
  143.     unsigned int m_numMatrices;
  144.  
  145.     // Matrix data for file
  146.     QubicleMatrix* m_pMatrices;
  147.  
  148.     // Render modes
  149.     bool m_renderWireFrame;
  150.  
  151.     // Material
  152.     unsigned int m_materialID;
  153. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement