Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.1 KiB

  1. #ifndef R_STUDIOSUBD_PATCHES_H
  2. #define R_STUDIOSUBD_PATCHES_H
  3. // Maximum valence we expect to encounter for extraordinary vertices
  4. #define MAX_VALENCE 19
  5. #define CORNER_WITH_SMOOTHBNDTANGENTS 2
  6. #include "mathlib/mathlib.h"
  7. #include "mathlib/vector4d.h"
  8. #include "mathlib/ssemath.h"
  9. #include "tier0/vprof.h"
  10. #define ALIGN(n) __declspec( align( n ) )
  11. // Undef this to use the unoptimized conversion routines
  12. #define USE_OPT
  13. // Uncomment this to separate computation between regular patches and extraordinary patches
  14. #define SEPARATE_REGULAR_AND_EXTRA
  15. // Uncomment this to disable tangent patch computation
  16. //#define NO_TANGENTS
  17. // if you change this make sure to adjust NUM_TOPOLOGY_INDICES_ATTRIBUTES in studiorendercontext.cpp as well!
  18. struct TopologyIndexStruct
  19. {
  20. unsigned short *vtx1RingSize;
  21. unsigned short *vtx1RingCenterQuadOffset;
  22. unsigned short *valences;
  23. unsigned short *minOneRingOffset;
  24. unsigned short *bndVtx;
  25. unsigned short *bndEdge;
  26. unsigned short *cornerVtx;
  27. unsigned short *loopGapAngle;
  28. unsigned short *edgeBias;
  29. unsigned short *nbCornerVtx;
  30. unsigned short *oneRing;
  31. unsigned short *vUV0;
  32. unsigned short *vUV1;
  33. unsigned short *vUV2;
  34. unsigned short *vUV3;
  35. };
  36. void set_ShowACCGeometryTangents(bool v);
  37. void set_CornerCorrection(bool v);
  38. void set_UseCornerTangents(bool v);
  39. void FillTables(); // fill patch stencil buffers
  40. // compute patch control points
  41. #if defined( USE_OPT )
  42. void ComputeACCAllPatches( fltx4* pWSVertices, TopologyIndexStruct* quad, Vector4D* Pos, Vector4D* TanU, Vector4D* TanV, bool bRegularPatch = false );
  43. #else
  44. void ComputeACCGeometryPatch( Vector4D* pWSVertices, TopologyIndexStruct *quad, Vector4D* Pos);
  45. void ComputeACCTangentPatches( Vector4D* pWSVertices, TopologyIndexStruct* quad, Vector4D* Pos, Vector4D* TanU, Vector4D* TanV );
  46. #endif
  47. void EvaluateACC(unsigned short nPoints, Vector2D *UVs, Vector4D *cpP, Vector4D *cpU, Vector4D *cpV, Vector4D *pos, Vector *nor, Vector2D *uv, Vector4D *tanU, Vector4D *tanV );
  48. void EvaluateGregory(unsigned short nPoints, Vector2D *UVs, Vector4D *cpP, Vector4D *pos, Vector *nor, Vector2D *uv, Vector4D *tanU, Vector4D *tanV );
  49. #endif //R_STUDIOSUBD_PATCHES_H