*/}}

la_tns.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431
  1. /*
  2. * LaGUI: A graphical application framework.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #pragma once
  19. #include "la_5.h"
  20. //#include "tinycthread.h"
  21. #include <float.h>
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. extern const char* TNS_SHADER_COLOR_COMMON;
  26. extern const char* TNS_VERTEX_SIMPLE_MATCAP;
  27. extern const char* TNS_FRAGMENT_SIMPLE_MATCAP;
  28. extern const char* TNS_VERTEX_GRID;
  29. extern const char* TNS_FRAGMENT_TRANSPARNT_GRID;
  30. extern const char* LA_FLOOR_VERTEX_SHADER;
  31. extern const char* LA_FLOOR_FRAGMENT_SHADER;
  32. extern const char* LA_IMM_VERTEX_SHADER;
  33. extern const char* LA_IMM_FRAGMENT_SHADER;
  34. extern const char* LA_OBJECT_FRAGMENT_SHADER;
  35. extern const char* LA_RAY_VERTEX_SHADER;
  36. extern const char* LA_SHADER_LIB_FXAA;
  37. extern const char* LA_RAY_FRAGMENT_SHADER;
  38. extern const char* LA_SCENE_VERTEX_SHADER;
  39. extern const char* LA_SCENE_FRAGMENT_SHADER;
  40. extern const char* LA_CASCADE_SHADOW_VERTEX_SHADER;
  41. extern const char* LA_CASCADE_SHADOW_FRAGMENT_SHADER;
  42. extern const char* LA_SELECTION_VERTEX_SHADER;
  43. extern const char* LA_SELECTION_FRAGMENT_SHADER;
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #define TNS_PI 3.1415926535897932384626433832795
  48. #define deg(r) ((r) / TNS_PI * 180.0)
  49. #define rad(d) ((d) *TNS_PI / 180.0)
  50. #define TNS_COLOR_SPACE_SRGB 0
  51. #define TNS_COLOR_SPACE_CLAY 1
  52. //typedef real tnsMatrix33d[9];
  53. typedef float tnsMatrix44f[16];
  54. typedef real tnsMatrix44d[16];
  55. typedef real tnsVector2d[2];
  56. typedef real tnsVector3d[3];
  57. typedef real tnsVector4d[4];
  58. typedef float tnsVector3f[3];
  59. typedef int tnsVector2i[2];
  60. typedef struct _tnsMatrixStackItem tnsMatrixStackItem;
  61. struct _tnsMatrixStackItem
  62. {
  63. tnsMatrix44d view;
  64. tnsMatrix44d model;
  65. tnsMatrix44d projection;
  66. };
  67. typedef struct _tnsMatrixStack tnsMatrixStack;
  68. struct _tnsMatrixStack
  69. {
  70. tnsMatrixStackItem *level;
  71. int current_level;
  72. int max_level;
  73. };
  74. typedef struct _tnsShader tnsShader;
  75. struct _tnsShader{
  76. laListItem Item;
  77. int vtShaderID;
  78. int fgShaderID;
  79. int gsShaderID;
  80. int glProgramID;
  81. int CustomID;
  82. int iModel, iProjection, iView, iProjectionInverse;
  83. int iShadow;
  84. int iVertex, iNormal, iColor, iUV;
  85. int iUseNormal;
  86. int iTexColor,iTexNormal,iTexGPos;
  87. int iTexColorMS;
  88. int iMultiplyColor, StateMultiplyColor;
  89. int iTextureMode, StateTextureMode, iColorMode,iHCYGamma;
  90. int iSampleAmount, StateSampleAmount;
  91. int iInputColorSpace, iOutputColorSpace, iShowStripes;
  92. int iComposing, iComposingGamma, iComposingBlackpoint;
  93. int iDoOffset;
  94. int iUseHalftone,iHalftoneSize;
  95. int uViewDir,uViewPos,uFOV,uNear,uFar;
  96. };
  97. typedef struct _tnsTexture tnsTexture;
  98. STRUCTURE(tnsCommand){
  99. GLenum Mode;
  100. short Dimensions; // 2 or 3
  101. short UVDimensions; // 2 or 3
  102. char UseVert;
  103. char UseColor;
  104. char UseNormal;
  105. char UseTexCoord;
  106. char UseIndex;
  107. GLenum PolyMode; //0-solid 1-wire
  108. GLenum Shade; //0-falt 1-smooth
  109. GLfloat UniformColor[4];
  110. real UseHalftone;
  111. int NumVert;
  112. int NumIndex;
  113. int VertBegin;
  114. int VertEnd; //'END'is the next one after the last one.
  115. int ColorBegin;
  116. int ColorEnd;
  117. int TexCoordBegin;
  118. int TexCoordEnd;
  119. int NormalBegin;
  120. int NormalEnd;
  121. GLushort IndexBegin;
  122. GLushort IndexEnd;
  123. tnsShader *ReplaceShader;
  124. tnsTexture *ColorTexture;
  125. int TextureMode;
  126. int MultiplyColor;
  127. GLfloat LineWidth,PointSize;
  128. };
  129. typedef struct _tnsMain tnsMain;
  130. typedef struct _tnsWorld tnsWorld;
  131. typedef struct _tnsObject tnsObject;
  132. struct _tnsWorld
  133. {
  134. laListItem Item;
  135. laListHandle RootObjects;
  136. tnsObject *ActiveRoot;
  137. laListHandle AllObjects;
  138. laListHandle Materials;
  139. laSafeString* MaterialLibraries;
  140. int PropertyPage;
  141. u16bit TimeYear;
  142. u8bit TimeMonth;
  143. u8bit TimeDay;
  144. laListHandle BezierCurves;
  145. laListHandle Meshes;
  146. };
  147. NEED_STRUCTURE(tnsLoopItem);
  148. NEED_STRUCTURE(tnsRenderLine);
  149. NEED_STRUCTURE(tnsRenderBuffer);
  150. STRUCTURE(tnsImage){
  151. laListItem Item;
  152. void* MemPNG;
  153. tnsTexture* Texture;
  154. int UserCount;
  155. };
  156. struct _tnsMain {
  157. laListItem Item;
  158. tnsMatrixStack stack;
  159. int vsx,vsy,vsw,vsh;//for saving scissor etc.
  160. int vol,vor,vou,vob;//for saving ortho etc.
  161. laListHandle Shaders;
  162. int NextShaderIndex;
  163. tnsShader *CurrentShader;
  164. tnsShader *BindedShader;
  165. GLuint CurrentVAO;
  166. SYSGLCONTEXT CurrentContext;
  167. #ifdef _WIN32
  168. SYSTEMDC CurrentDC;
  169. #endif
  170. #ifdef __linux__
  171. SYSWINDOW CurrentWindow;
  172. #endif
  173. //int MatrixMode;
  174. int IsOffscreen;
  175. laListHandle Offscreens;
  176. char *GLVersionStr;
  177. char *GLVendorStr;
  178. char *GLRendererStr;
  179. char *GLSLVersionStr;
  180. tnsShader* immShader;
  181. tnsShader* RayShader;
  182. tnsShader* ShadowShader;
  183. tnsShader* SceneShader;
  184. tnsShader* SelectionShader;
  185. tnsShader* FloorShader;
  186. tnsShader *uiShader;
  187. tnsShader *stringShader;
  188. tnsShader *TextureShader;
  189. tnsShader *RectangleTextureShader;
  190. tnsShader *TextureMultiplyShader;
  191. tnsShader *MSTextureShader;
  192. tnsShader *MSATextureShader;
  193. tnsShader *TEST_MatcapShader;
  194. tnsShader *TransparentGridShader;
  195. tnsShader *SobelColorShader;
  196. tnsShader *SobelShader;
  197. tnsShader *ExtraBuffersShader;
  198. laListHandle Textures;
  199. tnsTexture *PreviewTexture;
  200. GLenum GlTextureSets;
  201. // Corresponds to current GL_TEXTURE0/1...
  202. tnsTexture *TexColor;
  203. tnsTexture *TexRenderbuffer;
  204. // For commands
  205. tnsTexture *StateTexColor;
  206. int StateTextureMode;
  207. int StateMultiplyColor;
  208. int StateUseNormal;
  209. int SetUseNormal;
  210. real StateUseHalftone;
  211. real SetUseHalftone;
  212. real SetHalftoneSize;
  213. float SetViewPos[3];
  214. tnsShader* StateShader;
  215. GLfloat StateColor[4];
  216. GLfloat StateLineWidth,SetLineWidth;
  217. GLfloat StatePointSize,SetPointSize;
  218. GLfloat* Vert;
  219. GLuint VertBufObject;
  220. int NextVert, MaxVert;
  221. GLfloat* Color;
  222. GLuint ColorBufObject;
  223. int NextColor, MaxColor;
  224. GLfloat* Normal;
  225. GLuint NormalBufObject;
  226. int NextNormal, MaxNormal;
  227. GLfloat* TexCoord;
  228. GLuint TexCoordBufObject;
  229. int NextTexCoord, MaxTexCoord;
  230. GLuint* Index;
  231. GLuint IndexBufObject;
  232. int NextIndex, MaxIndex;
  233. tnsCommand* DrawingCommand;
  234. int NextCommand, MaxCommand;
  235. tnsWorld* World;
  236. laListHandle RenderBuffers;
  237. tnsRenderBuffer *ActiveRenderBuffer;
  238. laListHandle Images;
  239. };
  240. typedef struct _tnsTexture tnsTexture;
  241. struct _tnsTexture
  242. {
  243. laListItem Item;
  244. int IsRenderBuffer;
  245. GLuint GLTexHandle;
  246. GLint GLTexBitsType; //like GL_RGBA
  247. GLuint GLTexType; //like GL_TEXTURE_2D
  248. int Multisample;
  249. int Width;
  250. int Height;
  251. int Slices;
  252. void *DrawData;
  253. int RBWidth, RBHeight;
  254. int ElemSize;
  255. void *TextureReadBack;
  256. void **SamplePtr;
  257. laListHandle PendingSamples;
  258. laListHandle ErasedSamples;
  259. laListHandle LineStrips;
  260. };
  261. typedef struct _tnsOffscreen tnsOffscreen;
  262. struct _tnsOffscreen
  263. {
  264. laListItem Item;
  265. tnsTexture *pColor[16];
  266. tnsTexture *pDepth;
  267. GLuint FboHandle;
  268. SYSGLCONTEXT FboContext;
  269. #ifdef _WIN32
  270. SYSTEMDC FboDC;
  271. #endif
  272. #ifdef __linux__
  273. SYSWINDOW FboWindow;
  274. #endif
  275. int UseSecondary;
  276. };
  277. extern const GLuint TNS_ATTACHMENT_ARRAY_NONE[];
  278. extern const GLuint TNS_ATTACHMENT_ARRAY[];
  279. extern const GLuint TNS_ATTACHMENT_ARRAY_1[];
  280. extern const GLuint TNS_ATTACHMENT_ARRAY_2[];
  281. extern const GLuint TNS_ATTACHMENT_ARRAY_1_2[];
  282. extern const GLuint TNS_ATTACHMENT_ARRAY_0_1_2[];
  283. extern const GLenum TNS_WINDOW_DRAWBUFFER_ARRAY[];
  284. #define TNS_PROJECTION_MATRIX 1
  285. #define TNS_MODEL_MATRIX 2
  286. #define TNS_VIEW_MATRIX 3
  287. #define TNS_TEXTURE_MATRIX 4
  288. //==========================================================================[FT]
  289. #include "freetype/ftglyph.h"
  290. #include "freetype/ftoutln.h"
  291. #include "freetype/fttrigon.h"
  292. #include "ft2build.h"
  293. #include <stdarg.h>
  294. #include <stdlib.h>
  295. #include <string.h>
  296. NEED_STRUCTURE(tnsTexture);
  297. typedef struct _tnsFontSingleCharacter tnsFontSingleCharacter;
  298. struct _tnsFontSingleCharacter
  299. {
  300. tnsTexture *Tex;
  301. int Generated;
  302. short width;
  303. short height;
  304. real advx;
  305. short advy;
  306. short deltax;
  307. short deltay;
  308. short bufferx;
  309. short buffery;
  310. };
  311. #define TNS_UNICODE_COUNT ((unsigned int)(1<<17))
  312. #define TNS_MONO_COUNT (0x045f)
  313. typedef struct _tnsFont tnsFont;
  314. struct _tnsFont
  315. {
  316. laListItem Item;
  317. char *fontName;
  318. char *IconFontName;
  319. tnsFontSingleCharacter** characters; /* [(1<<17)] TNS_UNICODE_COUNT Unicode plane 0-1 */
  320. tnsFontSingleCharacter** monocharacters; /* [0x045f] TNS_MONO_COUNT Up to cryllic. */
  321. FT_Library ftlib;
  322. FT_Face ftface[16];
  323. FT_Face ftfacemono;
  324. int NumFaces;/* excludes mono. */
  325. real MonoScale;
  326. real MonoAdvance;
  327. real size;
  328. unsigned int height;
  329. tnsTexture TexBuffer;
  330. int CurrentX;
  331. int CurrentY;
  332. };
  333. typedef struct _tnsFontManager tnsFontManager;
  334. struct _tnsFontManager
  335. {
  336. laListHandle Fonts;
  337. tnsFont *UsingFont;
  338. tnsFont *VectorsGrapghs;
  339. int BufferWidth;
  340. unsigned LastDlst;
  341. };
  342. typedef struct _tnsFontBoundBox tnsFontBoundBox;
  343. struct _tnsFontBoundBox
  344. {
  345. int x, y, w, h; /* Upper Left and width,height */
  346. };
  347. #define TNS_FONT_BUFFER_W_DEFAULT 512
  348. //=====================================================[3d comp]
  349. typedef struct _tnsWorld tnsWorld;
  350. typedef struct _tnsObject tnsObject;
  351. #define TNS_ROTATION_XYZ_EULER 0
  352. #define TNS_ROTATION_XZY_EULER 1
  353. #define TNS_ROTATION_YXZ_EULER 2
  354. #define TNS_ROTATION_YZX_EULER 3
  355. #define TNS_ROTATION_ZXY_EULER 4
  356. #define TNS_ROTATION_ZYX_EULER 5
  357. #define TNS_ROTATION_QUATERNION 6
  358. #define TNS_OBJECT_ROOT 0
  359. #define TNS_OBJECT_INSTANCER (1<<0)
  360. #define TNS_OBJECT_CAMERA (1<<1)
  361. #define TNS_OBJECT_LIGHT (1<<2)
  362. #define TNS_OBJECT_MESH (1<<3)
  363. #define TNS_OBJECT_SHAPE (1<<4)
  364. #define TNS_OBJECT_FLAGS_SELECTED (1<<0)
  365. #define TNS_OBJECT_FLAGS_PLAY_DUPLICATE (1<<1)
  366. NEED_STRUCTURE(tnsBatch)
  367. #define TNS_EVAL_LAYER_SOLID (1<<0)
  368. #define TNS_EVAL_LAYER_OVERLAY (1<<1)
  369. #define TNS_EVAL_LAYER_OUTLINE (1<<2)
  370. #define TNS_EVAL_LAYER_SELECTION (1<<3)
  371. #define TNS_EVAL_LAYER_NO_2D (1<<4)
  372. #define TNS_EVAL_LAYER_BACKDROP (1<<5)
  373. #define TNS_EVAL_MODE_INIT (1<<0)
  374. #define TNS_EVAL_MODE_ALWAYS (1<<1)
  375. #define TNS_EvAL_MODE_DEINIT (1<<2)
  376. NEED_STRUCTURE(tnsEvaluatedInstance);
  377. typedef void (*tnsDrawEvaluatedInstanceF)(tnsEvaluatedInstance* ei, void* CustomData);
  378. STRUCTURE(tnsEvaluatedNode){
  379. laListItem Item;
  380. tnsMatrix44d Mat;
  381. tnsObject* Target;
  382. laListHandle Children;
  383. int LuaID, LuaLoaded;
  384. };
  385. STRUCTURE(tnsEvaluatedScene){
  386. int NextLuaID;
  387. laListHandle WastedEvaluateNodes;
  388. tnsEvaluatedNode* Root;
  389. tnsEvaluatedNode* CurrentParent;
  390. tnsEvaluatedNode* CurrentChild;
  391. };
  392. STRUCTURE(tnsEvaluatedInstance){
  393. tnsObject *Object;
  394. tnsMatrix44d Mat;
  395. int IsActive;
  396. int MeshSelectionType;
  397. int InstanceSelectionID;
  398. tnsDrawEvaluatedInstanceF Draw;
  399. };
  400. STRUCTURE(tnsEvaluateData){
  401. int Done;
  402. int SceneEvaluateMode;
  403. tnsObject *Active;
  404. int FillOutline;
  405. int FillSelectionID;
  406. int OverrideID;
  407. laListHandle ParentStack;
  408. tnsEvaluatedInstance* Backdrop; int NextBackdrop, MaxBackdrop;
  409. tnsEvaluatedInstance* Commands; int NextCommand, MaxCommand;
  410. tnsEvaluatedInstance* Outlines; int NextOutline, MaxOutline;
  411. tnsEvaluatedInstance* Overlays; int NextOverlay, MaxOverlay;
  412. tnsEvaluatedInstance* Selections; int NextSelection, MaxSelection;
  413. tnsMatrix44d* MatArr; int NextMat, MaxMat;
  414. tnsEvaluatedScene* Scene;
  415. lua_State* L;
  416. };
  417. NEED_STRUCTURE(laRackPageCollection);
  418. NEED_STRUCTURE(tnsMaterial);
  419. STRUCTURE(tnsObject){
  420. laListItem Item;
  421. int Type;
  422. int SelectID;
  423. int Flags;
  424. //u64bit ID;
  425. laSafeString *Name;
  426. int DrawMode;
  427. int Show;
  428. int ShowOnRender;
  429. int HideChildren;
  430. int RotationMode;
  431. int IsInstanced;
  432. real GLocation[3]; real GRotation[3]; real GScale[3];
  433. real Location[3]; real Rotation[4]; real Scale[3];
  434. // delta transforms for animation & drivers.
  435. real DLocation[3]; real DRotation[3]; real DScale[3];
  436. tnsMatrix44d GlobalTransform;
  437. tnsMatrix44d SelfTransform;
  438. tnsMatrix44d DeltaTransform;
  439. tnsObject *Active; // may be used to store last select info in child objects.
  440. tnsObject *InRoot;
  441. tnsObject *ParentObject; // reused as root active sun.
  442. laListHandle ChildObjects;
  443. laRackPageCollection* Drivers; // rack
  444. laListHandle Actions;
  445. tnsEvaluateData Evaluated; // runtime
  446. tnsEvaluateData EvaluatedPlay; int LuaCacheID;
  447. tnsObject* PlayDuplicate;
  448. tnsObject* EditDuplicateTemp;
  449. };
  450. NEED_STRUCTURE(laNodeInSocket);
  451. NEED_STRUCTURE(laNodeOutSocket);
  452. STRUCTURE(tnsTransformNode){
  453. laBaseNode Base;
  454. laNodeInSocket* Mat;
  455. tnsObject* Target;
  456. };
  457. STRUCTURE(tnsMakeTransformNode){
  458. laBaseNode Base;
  459. laNodeInSocket* Loc; laNodeInSocket* Rot; laNodeInSocket* Angle; laNodeInSocket* Sca;
  460. laNodeOutSocket* Out;
  461. tnsMatrix44d Mat; tnsVector3d UseLoc; tnsVector3d UseRot; real UseSca; real UseAngle;
  462. };
  463. #define TNS_CAMERA_PERSP 0
  464. #define TNS_CAMERA_ORTHO 1
  465. #define TNS_ID_TO_COLOR(color, i) \
  466. {color[0]=(real)((i & 0x000000FF)>>0)/255.0; color[1]=(real)((i & 0x0000FF00)>>8)/255.0; color[2]=(real)((i & 0x00FF0000)>>16)/255.0;}
  467. STRUCTURE(tnsMaterial){
  468. laListItem Item;
  469. laSafeString *Name;
  470. real Color[4];
  471. int Colorful;
  472. int AsLibrary;
  473. laRackPage* Page;
  474. tnsShader* Shader;
  475. };
  476. #define TNS_CAMERA_PERSPECTIVE 0
  477. #define TNS_CAMERA_ORTHO 1
  478. #define TNS_CAMERA_FISHEYE 2
  479. STRUCTURE(tnsRootObject){
  480. tnsObject Base;
  481. int Is2D;
  482. tnsObject* ActiveCamera;
  483. };
  484. STRUCTURE(tnsInstancer){
  485. tnsObject Base;
  486. tnsObject* Instance;
  487. };
  488. STRUCTURE(tnsCamera){
  489. tnsObject Base;
  490. int CameraType;
  491. real FOV;
  492. real ZMin, ZMax;
  493. real FocusDistance;
  494. real OrthScale;
  495. tnsVector3d RenderViewDir;
  496. };
  497. STRUCTURE(tnsLight){
  498. tnsObject Base;
  499. int LightType;
  500. int UniDirectional;
  501. real Strength;
  502. tnsMaterial *Material;
  503. };
  504. #define TNS_MESH_FLAG_SELECTED (1<<0)
  505. #define TNS_MESH_FLAG_PICKED (1<<1)
  506. #define TNS_MESH_FLAG_LOOP_REVERSE (1<<2)
  507. STRUCTURE(tnsMVert){
  508. laListItem Item;
  509. tnsVector3d p;
  510. tnsVector3d n;
  511. int flags;
  512. u32bit i;
  513. laListHandle elink;
  514. //laListHandle flink;
  515. };
  516. NEED_STRUCTURE(tnsMFace);
  517. STRUCTURE(tnsMEdge){
  518. laListItem Item;
  519. tnsMVert *vl;
  520. tnsMVert *vr;
  521. tnsMFace *fl;
  522. tnsMFace *fr;
  523. u32bit i;
  524. int flags;
  525. };
  526. STRUCTURE(tnsMFace){
  527. laListItem Item;
  528. laListHandle l; //list item pointer of edges
  529. tnsVector3d n;
  530. tnsVector3d c;
  531. short looplen;
  532. short mat;
  533. u32bit i;
  534. int flags;
  535. };
  536. STRUCTURE(tnsVert){
  537. tnsVector3f p;
  538. tnsVector3f n;
  539. int flags;
  540. };
  541. STRUCTURE(tnsEdge){
  542. int l,r;
  543. int flags;
  544. };
  545. STRUCTURE(tnsFace){
  546. int* loop;
  547. int flags;
  548. tnsVector3f n;
  549. short looplen;
  550. short mat;
  551. };
  552. STRUCTURE(tnsBatchCommand){
  553. laListItem Item;
  554. char* name;
  555. int DrawElements;
  556. GLuint EBO; //elem
  557. u32bit ElementCount;
  558. GLenum DrawAs;
  559. GLuint CBO; int ColorDimension; int OverrideColorArray;
  560. int Dimension;
  561. int HiddenByDefault;
  562. int UseUniformColor; real UniformColor[4];
  563. tnsMaterial* Material;
  564. real Width;
  565. };
  566. STRUCTURE(tnsBatch){
  567. laListItem Item;
  568. GLuint VBO; //vert
  569. GLuint NBO; int HasNormal; //normal
  570. GLuint CBO; int HasColor; //color
  571. u32bit NumVert;
  572. int Dimension;
  573. int NormalDimension;
  574. int ColorDimension;
  575. laListHandle Branches;
  576. GLuint BeginElementOffset;
  577. };
  578. #define TNS_MESH_OBJECT_MODE 0
  579. #define TNS_MESH_EDIT_MODE 1
  580. extern laPropContainer* TNS_PC_OBJECT_GENERIC;
  581. extern laPropContainer* TNS_PC_OBJECT_INSTANCER;
  582. extern laPropContainer* TNS_PC_OBJECT_CAMERA;
  583. extern laPropContainer* TNS_PC_OBJECT_LIGHT;
  584. extern laPropContainer* TNS_PC_OBJECT_MESH;
  585. extern laPropContainer* TNS_PC_OBJECT_SHAPE;
  586. extern laPropContainer* TNS_PC_OBJECT_ROOT;
  587. extern laPropContainer* TNS_PC_MATERIAL;
  588. extern laPropContainer* TNS_PC_MATERIAL_SLOT;
  589. #define TNS_HINT_TRANSFORM (1<<1)
  590. #define TNS_HINT_GEOMETRY (1<<0)
  591. STRUCTURE(tnsMeshFaceStorageSingleHead){
  592. int looplen, flags; //[1] [5] [4] [2] ... [-1 as end]
  593. };
  594. STRUCTURE(tnsMeshFaceStorage){
  595. int len; int arr;
  596. };
  597. STRUCTURE(tnsMaterialSlot){
  598. laListItem Item;
  599. tnsMaterial* Material;
  600. tnsObject* Parent;
  601. short Index;
  602. };
  603. #define TNS_SPOINT_ALIGNED (1<<3)
  604. #define TNS_SPOINT_FREE (1<<4)
  605. #define TNS_SPOINT_SELECTED_L (1<<5)
  606. #define TNS_SPOINT_SELECTED_R (1<<6)
  607. #define TNS_SPOINT_BEZIER (TNS_SPOINT_ALIGNED|TNS_SPOINT_FREE)
  608. #define TNS_SPOINT_SELECTED (TNS_MESH_FLAG_SELECTED|TNS_SPOINT_SELECTED_R|TNS_SPOINT_SELECTED_L)
  609. #define TNS_SHAPE_CLOSED (1<<7)
  610. #define TNS_SHAPE_HOLE (1<<8)
  611. STRUCTURE(tnsSPoint){
  612. laListItem Item;
  613. tnsVector2d p,dl,dr;
  614. int flags;
  615. u32bit i;
  616. };
  617. STRUCTURE(tnsShape){
  618. laListItem Item;
  619. laListHandle Points;
  620. int flags;
  621. short mat;
  622. };
  623. STRUCTURE(tnsShapeObject){
  624. tnsObject Base;
  625. laListHandle Shapes;
  626. tnsBatch *Batch;
  627. tnsBatch *ExtraBatch;
  628. tnsMaterialSlot* CurrentMaterial;
  629. laListHandle Materials;
  630. int Mode;
  631. int Backdrop;
  632. };
  633. STRUCTURE(tnsMeshObject){
  634. tnsObject Base;
  635. tnsVert* v; int totv, maxv;
  636. tnsEdge* e; int tote, maxe; // I intend this to only stores floating edges.
  637. tnsFace* f; int totf, maxf;
  638. laListHandle mv; int totmv;
  639. laListHandle me; int totme;
  640. laListHandle mf; int totmf;
  641. int TriangleCount;
  642. int TriangulatedEdgeCount;
  643. tnsMVert* LastSelectV, *FirstSelectV;
  644. tnsMEdge* LastSelectE, *FirstSelectE;
  645. tnsBatch *Batch;
  646. tnsBatch *ExtraBatch;
  647. tnsMaterialSlot* CurrentMaterial;
  648. laListHandle Materials;
  649. int Mode;
  650. };
  651. STRUCTURE(tnsEdgeHashEdge){
  652. int tv; tnsMEdge* me;
  653. };
  654. STRUCTURE(tnsEdgeHashVert){
  655. tnsEdgeHashEdge* e; int max, next; tnsMVert* mv;
  656. };
  657. STRUCTURE(tnsEdgeHash){
  658. tnsEdgeHashVert* vl; int max,next;
  659. };
  660. #define TNS_TILE(tile, r, c, CCount) \
  661. tile[r * CCount + c]
  662. #define TNS_CLAMP(a, Min, Max) \
  663. a = a < Min ? Min : (a > Max ? Max : a)
  664. #define TNS_MAX2(a, b) \
  665. (a > b ? a : b)
  666. #define TNS_MIN2(a, b) \
  667. (a < b ? a : b)
  668. #define TNS_MAX3(a, b, c) \
  669. (a > TNS_MAX2(b, c) ? a : TNS_MAX2(b, c))
  670. #define TNS_MIN3(a, b, c) \
  671. (a < TNS_MIN2(b, c) ? a : TNS_MIN2(b, c))
  672. #define TNS_MAX2_INDEX(a, b) \
  673. (a > b ? 0 : 1)
  674. #define TNS_MIN2_INDEX(a, b) \
  675. (a < b ? 0 : 1)
  676. #define TNS_MAX3_INDEX(a, b, c) \
  677. (a > b ? (a > c ? 0 : (b > c ? 1 : 2)) : (b > c ? 1 : 2))
  678. #define TNS_MIN3_INDEX(a, b, c) \
  679. (a < b ? (a < c ? 0 : (b < c ? 1 : 2)) : (b < c ? 1 : 2))
  680. #define TNS_MAX3_INDEX_ABC(x, y, z) \
  681. (x > y ? (x > z ? a : (y > z ? b : c)) : (y > z ? b : c))
  682. #define TNS_MIN3_INDEX_ABC(x, y, z) \
  683. (x < y ? (x < z ? a : (y < z ? b : c)) : (y < z ? b : c))
  684. #define TNS_ABC(index) \
  685. (index == 0 ? a : (index == 1 ? b : c))
  686. #define TNS_DOUBLE_CLOSE_ENOUGH(a, b) \
  687. (((a) + DBL_EDGE_LIM) >= (b) && ((a)-DBL_EDGE_LIM) <= (b))
  688. //#define TNS_DOUBLE_CLOSE_ENOUGH(a,b) \
  689. //(((a)+0.00000000001)>=(b) && ((a)-0.0000000001)<=(b))
  690. #define TNS_FLOAT_CLOSE_ENOUGH_WIDER(a, b) \
  691. (((a) + 0.0000001) >= (b) && ((a)-0.0000001) <= (b))
  692. #define TNS_FRAMEBUFFER_PIXEL(FrameBuffer, Row, Column) \
  693. &((FrameBuffer)->Pixels[Row * FrameBuffer->TileSizeW * FrameBuffer->W * FrameBuffer->SubPixelSample + Column * FrameBuffer->H * FrameBuffer->TileSizeH * FrameBuffer->SubPixelSample])
  694. #define TNS_IN_TILE_X(RenderTile, Fx) \
  695. (RenderTile->FX <= Fx && RenderTile->FXLim >= Fx)
  696. #define TNS_IN_TILE_Y(RenderTile, Fy) \
  697. (RenderTile->FY <= Fy && RenderTile->FYLim >= Fy)
  698. #define TNS_IN_TILE(RenderTile, Fx, Fy) \
  699. (TNS_IN_TILE_X(RenderTile, Fx) && TNS_IN_TILE_Y(RenderTile, Fy))
  700. void tnsSetuptnsFontManager();
  701. tnsShader *tnsNewShaderProgram(int VertexShaderID, int FragmentShaderID, int GeometryShaderID);
  702. int tnsNewGeometryShader(char *Content);
  703. int tnsNewFragmentShader(char *Content);
  704. int tnsNewFragmentShaderMaterial(char *Content, char* Library, char* Material);
  705. int tnsNewVertexShader(char *Content);
  706. void tnsDeleteShaderProgram(tnsShader* s);
  707. int tnsNextPowOf2(int i);
  708. int tnsEnableShader(int index);
  709. int tnsEnableShaderv(tnsShader *shader);
  710. int tnsUseShader(tnsShader *shader);
  711. void tnsUseImmShader();
  712. void tnsUseShadowShader();
  713. void tnsUseSceneShader();
  714. void tnsUseRayShader();
  715. void tnsUseTransparentGridShader();
  716. void tnsUseImagePeelShader();
  717. void tnsInit();
  718. void tnsInitRenderKernel(int matrixStackLevel);
  719. void tnsInitBuiltinShaders();
  720. void tnsInitWindowDefaultRenderConfig();
  721. void tnsQuit();
  722. void tnsRestoreFromNanoVG();
  723. real *tnsGetModelMatrix();
  724. real *tnsGetViewMatrix();
  725. real *tnsGetProjectionMatrix();
  726. void tnsGetMVMatrix(tnsMatrix44d r);
  727. void tnsGetMVPMatrix(tnsMatrix44d r);
  728. void tnsResetModelMatrix();
  729. void tnsResetViewMatrix();
  730. void tnsResetProjectionMatrix();
  731. void tnsOrtho(real xMin, real xMax, real yMin, real yMax, real zMin, real zMax);
  732. void tnsPerspective(real fFov_rad, real fAspect, real zMin, real zMax);
  733. void tnsPopMatrix();
  734. void tnsPushMatrix();
  735. void tnsTranslate3d(real x, real y, real z);
  736. void tnsPreTranslate3d(real x, real y, real z);
  737. void tnsRotate4d(real degrees, real x, real y, real z);
  738. void tnsPreRotate4d(real degrees, real x, real y, real z);
  739. void tnsScale3d(real x, real y, real z);
  740. void tnsPreScale3d(real x, real y, real z);
  741. void tnsColor4d(real r, real g, real b, real a);
  742. void tnsColor4dv(real *rgba);
  743. void tnsLineWidth(real Width);
  744. void tnsPointSize(real PointSize);
  745. tnsBatch *tnsCreateBatch(u32bit NumVert, int Dimension, float *Data, int NormalDimension, float *Normal, int ColorDimension, float *Colors);
  746. tnsBatch *tnsCreateBatchi(u32bit NumVert, int Dimension, int *Data);
  747. void tnsCommandUseWidth(tnsBatchCommand*c, real width);
  748. void tnsCommandUseUniformColor(tnsBatchCommand*c,real* color);
  749. void tnsCommandUseMaterial(tnsBatchCommand*c, tnsMaterial* material);
  750. void tnsCommandOverrideColorArray(tnsBatchCommand*c, int VertCount, int ColorDimension, float* colors);
  751. tnsBatchCommand *tnsCreateCommand(tnsBatch *b, const char* name, u32bit ElementCount, int Dimension, GLenum DrawAs, u32bit *Elements, int HiddenByDefault);
  752. void tnsDeleteBatch(tnsBatch *b);
  753. int tnsDrawBatch(tnsBatch* batch, const char* OverrideCommand, real* OverrideUniformColor, int OverrideAsArray);
  754. void tnsVertex3d(real x, real y, real z);
  755. void tnsVertex2d(real x, real y);
  756. void tnsVertexArray2d(real *verts, int amount);
  757. void tnsVertexArray3d(real *verts, int amount);
  758. void tnsColorArray4d(real *colors, int amount);
  759. void tnsNormalArray3d(real *normals, int amount);
  760. void tnsTexCoordArray2d(real *coords, int amount);
  761. void tnsTexCoordArray3d(real *coords, int amount);
  762. void tnsIndexArray(GLuint *index, short amount);
  763. void tnsPackAs(GLenum Mode);
  764. void tnsFlush();
  765. #define tnsLinearItp(L, R, T) \
  766. ((L) * (1.0f - (T)) + (R) * (T))
  767. double tnsGetRatiod(real L, real R, real FromL);
  768. void tnsShaderApplyProjectionInverse(tnsShader *tns, tnsMatrix44d m);
  769. void tnsShaderApplyProjection(tnsShader *tns, tnsMatrix44d m);
  770. void tnsShaderApplyModel(tnsShader *tns, tnsMatrix44d m);
  771. void tnsShaderApplyView(tnsShader *tns, tnsMatrix44d m);
  772. void tnsShaderApplyNormalScaler(tnsShader *tns, tnsMatrix44d m);
  773. int tnsLineIntersectTest2d(tnsVector2d a1, tnsVector2d a2, tnsVector2d b1, tnsVector2d b2, double *aRatio);
  774. double tnsGetLineZ(tnsVector3d L, tnsVector3d R, real Ratio);
  775. double tnsGetLineZPoint(tnsVector3d L, tnsVector3d R, tnsVector3d FromL);
  776. double tnsGetRatio3d(tnsVector3d L, tnsVector3d R, tnsVector3d FromL);
  777. double tnsGetRatiod(real L, real R, real FromL);
  778. real tnsInterpolate(real L, real R, real T);
  779. void tnsInterpolate2dv(real *L, real *R, real T, real *Result);
  780. void tnsInterpolate3dv(real *L, real *R, real T, real *Result);
  781. void tnsInterpolateTripple2d(tnsVector2d v1, tnsVector2d v2, tnsVector2d v3, real ratio, tnsVector2d result);
  782. void tnsVectorMinus2d(tnsVector2d result, tnsVector2d l, tnsVector2d r);
  783. void tnsVectorMinus3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
  784. void tnsVectorSubtract3d(tnsVector3d l, tnsVector3d r);
  785. void tnsVectorPlus3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
  786. void tnsVectorAccum3d(tnsVector3d l, tnsVector3d r);
  787. void tnsVectorAccum2d(tnsVector2d l, tnsVector2d r);
  788. void tnsVectorNegate3d(tnsVector3d result, tnsVector3d l);
  789. void tnsVectorNegateSelf3d(tnsVector3d l);
  790. void tnsVectorCopy2d(tnsVector2d from, tnsVector2d to);
  791. void tnsVectorCopy3d(tnsVector3d from, tnsVector3d to);
  792. void tnsVectorCopy4d(tnsVector4d from, tnsVector4d to);
  793. void tnsVectorMultiSelf4d(tnsVector4d from, real num);
  794. void tnsVectorMultiSelf3d(tnsVector3d from, real num);
  795. void tnsVectorMultiSelf2d(tnsVector2d from, real num);
  796. void tnsVectorMulti4d(tnsVector4d to, tnsVector4d from, real num);
  797. void tnsVectorMulti3d(tnsVector3d to, tnsVector3d from, real num);
  798. void tnsVectorMulti2d(tnsVector2d to, tnsVector2d from, real num);
  799. real tnsDirectionToRad(tnsVector2d Dir);
  800. void tnsConvert44df(tnsMatrix44d from, tnsMatrix44f to);
  801. #define tnsVectorSet2(to, x,y) \
  802. {(to)[0]=x;(to)[1]=y;}
  803. #define tnsVectorSet3(to, x,y,z) \
  804. {(to)[0]=x;(to)[1]=y;(to)[2]=z;}
  805. #define tnsVectorSet4(to, x,y,z,w) \
  806. {(to)[0]=x;(to)[1]=y;(to)[2]=z;(to)[3]=w;}
  807. #define tnsVectorSet2v(to, from) \
  808. tnsVectorSet2(to,(from)[0],(from)[1])
  809. #define tnsVectorSet3v(to, from) \
  810. tnsVectorSet3(to,(from)[0],(from)[1],(from)[2])
  811. #define tnsVectorSet4v(to, from) \
  812. tnsVectorSet4(to,(from)[0],(from)[1],(from)[2],(from)[3])
  813. real tnsDistIdv2(real x1, real y1, real x2, real y2);
  814. real tnsDist3dv(tnsVector3d l, tnsVector3d r);
  815. real tnsDist2dv(tnsVector2d l, tnsVector2d r);
  816. real tnsLength3d(tnsVector3d l);
  817. real tnsLength2d(tnsVector2d l);
  818. void tnsNormalize3d(tnsVector3d result, tnsVector3d l);
  819. void tnsNormalizeSelf2d(tnsVector3d result);
  820. void tnsNormalizeSelf3d(tnsVector3d result);
  821. real tnsDot3d(tnsVector3d l, tnsVector3d r, int normalize);
  822. real tnsDot2d(tnsVector2d l, tnsVector2d r, int normalize);
  823. real tnsVectorCross3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
  824. real tnsAngleRad3d(tnsVector3d from, tnsVector3d to, tnsVector3d PositiveReference);
  825. void tnsApplyRotation33d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
  826. void tnsApplyRotation43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
  827. void tnsApplyTransform43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
  828. void tnsApplyNormalTransform43d(tnsVector3d result, tnsMatrix44d mat, tnsVector3d v);
  829. void tnsApplyTransform44d(tnsVector4d result, tnsMatrix44d mat, tnsVector4d v);
  830. void tnsApplyTransform44dTrue(tnsVector4d result, tnsMatrix44d mat, tnsVector4d v);
  831. void tnsLoadIdentity44d(tnsMatrix44d m);
  832. void tnsMakeOrthoMatrix44d(tnsMatrix44d mProjection, real xMin, real xMax, real yMin, real yMax, real zMin, real zMax);
  833. void tnsMakePerspectiveMatrix44d(tnsMatrix44d mProjection, real fFov_rad, real fAspect, real zMin, real zMax);
  834. void tnsMakeTranslationMatrix44d(tnsMatrix44d mTrans, real x, real y, real z);
  835. void tnsMakeRotationMatrix44d(tnsMatrix44d m, real angle_rad, real x, real y, real z);
  836. void tnsMakeScaleMatrix44d(tnsMatrix44d m, real x, real y, real z);
  837. void tnsMakeViewportMatrix44d(tnsMatrix44d m, real w, real h, real Far, real Near);
  838. void tnsInverse44d(tnsMatrix44d inverse, tnsMatrix44d mat);
  839. void tnsMultiply44d(tnsMatrix44d result, tnsMatrix44d l, tnsMatrix44d r);
  840. void tnsMakeRotationXMatrix44d(tnsMatrix44d m, real angle_rad);
  841. void tnsMakeRotationYMatrix44d(tnsMatrix44d m, real angle_rad);
  842. void tnsMakeRotationZMatrix44d(tnsMatrix44d m, real angle_rad);
  843. void tnsRemoveTranslation44d(tnsMatrix44d result, tnsMatrix44d mat);
  844. void tnsClearTranslation44d(tnsMatrix44d mat);
  845. real tnsAngleRad3d(tnsVector3d from, tnsVector3d to, tnsVector3d PositiveReference);
  846. real tnsLength3d(tnsVector3d l);
  847. void tnsNormalize2d(tnsVector2d result, tnsVector2d l);
  848. void tnsNormalize3d(tnsVector3d result, tnsVector3d l);
  849. void tnsNormalizeSelf3d(tnsVector3d result);
  850. real tnsDot3d(tnsVector3d l, tnsVector3d r, int normalize);
  851. real tnsVectorCross3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
  852. void tnsVectorCrossOnly3d(tnsVector3d result, tnsVector3d l, tnsVector3d r);
  853. void tnsExtractXYZEuler44d(tnsMatrix44d mat, real *xyz_result);
  854. void tnsPrintMatrix44d(tnsMatrix44d l);
  855. int tnsPointInsideTriangle3d(tnsVector3d v, tnsVector3d v0, tnsVector3d v1, tnsVector3d v2);
  856. int tnsIntersectPlaneRay(tnsVector3d n, tnsVector3d p0, tnsVector3d l0, tnsVector3d l, real* t);
  857. void tnsExtractXYZEuler44d(tnsMatrix44d mat, real *xyz_result);
  858. void tnsExtractLocation44d(tnsMatrix44d mat, real *xyz_result);
  859. void tnsExtractScale44d(tnsMatrix44d mat, real *xyz_result);
  860. void tnsSelfMatrixChanged(tnsObject* o, int ApplyToChild);
  861. void tnsGlobalMatrixChanged(tnsObject* o, int ApplyToChild);
  862. void tnsGlobalMatrixChangedForDelta(tnsObject* o, int ApplyToChild);
  863. void tnsSelfTransformValueChanged(tnsObject* o);
  864. void tnsDeltaTransformValueChanged(tnsObject* o);
  865. void tnsGlobalTransformValueChanged(tnsObject* o);
  866. void tnsClearPlayDuplicate(tnsObject* o);
  867. void tnsFreeEvaluatedNode(tnsEvaluatedNode* n);
  868. void tnsFreeEvaluatedScene(tnsEvaluateData* ed);
  869. void tnsClearPlayState(tnsObject* o);
  870. void tnsExtrtnsEnsurePlayDuplicate(tnsObject *o);
  871. void tnsExtractSelfTransformValue(tnsObject *o);
  872. void tnsExtractGlobalTransformValue(tnsObject *o);
  873. void tnsSetCurrentRoot(tnsObject *o);
  874. void tnsInitObjectBase(tnsObject *o, tnsObject *under, char *Name, int Type,
  875. real AtX, real AtY, real AtZ,
  876. real RotX, real RotY, real RotZ, real RotW, u8bit RotationMode,
  877. real Scale);
  878. tnsMeshObject *tnsLoadObjectFromFile(char *FileName);
  879. int tnsLoadExchange(char *FileName);
  880. tnsObject *tnsFindObject(char *Name, tnsObject *From);
  881. void tns_RegisterNodes();
  882. void tnsCopyObjectTransformationsLocal(tnsObject* to, tnsObject* from);
  883. void tnsCopyObjectTransformationsGlobal(tnsObject* to, tnsObject* from);
  884. void tnsRotateObjectGlobal(tnsObject *o, real x, real y, real z, real angle, real cx,real cy,real cz);
  885. void tnsRotateObjectDelta(tnsObject *o, real x, real y, real z, real angle);
  886. void tnsRotateObjectLocal(tnsObject *o, real x, real y, real z, real angle);
  887. void tnsRotateObjectLocalValues(tnsObject *o, real x, real y, real z);
  888. void tnsRotateObjectGlobalForDelta(tnsObject *o, real x, real y, real z, real angle, real cx,real cy,real cz);
  889. void tnsTranslateObjectGlobal(tnsObject *o, real x, real y, real z);
  890. void tnsTranslateObjectLocal(tnsObject *o, real x, real y, real z);
  891. void tnsSetObjectPositionLocal(tnsObject*o, real x, real y, real z);
  892. void tnsResetObjectTransformations(tnsObject* o, int reset_loc,int reset_rot,int reset_sca);
  893. void tnsMoveObjectLocal(tnsObject *o, real x, real y, real z);
  894. void tnsMoveObjectDelta(tnsObject *o, real x, real y, real z);
  895. void tnsMoveObjectGlobal(tnsObject *o, real x, real y, real z);
  896. void tnsMoveObjectGlobalForDelta(tnsObject *o, real x, real y, real z);
  897. void tnsScaleObject(tnsObject *o, real x,real y,real z, real cx,real cy,real cz);
  898. void tnsScaleObjectDelta(tnsObject *o, real x,real y,real z, real cx,real cy,real cz);
  899. int tnsCheckParentable(tnsObject* child, tnsObject* parent);
  900. void tnsParentObject(tnsObject *child, tnsObject *parent, int KeepTransform);
  901. void tnsUnparentObject(tnsObject *o, int KeepTransform);
  902. void tnsZoomViewingCamera(tnsCamera *c, real Ratio);
  903. void tnsRotateViewingCamera(tnsCamera *c, real x, real z);
  904. void tnsTranslateViewingCamera(tnsCamera *c, int ViewportW, int ViewportH, real x, real y);
  905. void tnsGetCameraMovingDeltas(tnsCamera *c, int ViewportW, int ViewportH, real x, real y, tnsVector4d p);
  906. laPropContainer* tnsget_ObjectType(tnsObject* o);
  907. void *tnsget_detached_FirstRootObject(void *UNUSED1, void *UNUSED2);
  908. void tnsDestroyRootObject(tnsObject *root);
  909. void tnsDestroyObject(tnsObject *o);
  910. tnsObject *tnsCreateRootObject(char *name, int Use2D);
  911. tnsCamera *tnsCreateCamera(tnsObject *under, char *Name, real FOV,
  912. real AtX, real AtY, real AtZ,
  913. real RotX, real RotY, real RotZ,
  914. real FocusDistance);
  915. tnsObject *tnsCreateInstancer(tnsObject *under, char *Name, real AtX, real AtY, real AtZ);
  916. tnsLight *tnsCreateLight(tnsObject *under, char *Name, real AtX, real AtY, real AtZ, real Strength, int UniDirectional);
  917. tnsMeshObject *tnsCreateMeshEmpty(tnsObject *under, char *Name, real AtX, real AtY, real AtZ);
  918. tnsMeshObject *tnsCreateMeshPlane(tnsObject *under, char *Name, real AtX, real AtY, real AtZ, real size);
  919. tnsShapeObject *tnsCreateShapeEmpty(tnsObject *under, char *Name, real AtX, real AtY, real AtZ);
  920. tnsShapeObject *tnsCreateShapeSquare(tnsObject *under, char *Name, real AtX, real AtY, real AtZ, real size);
  921. int tnsMergeMeshObjects(tnsMeshObject* into, tnsMeshObject* mo);
  922. tnsInstancer* tnsDuplicateInstancer(tnsInstancer* from);
  923. tnsMeshObject* tnsDuplicateMeshObject(tnsMeshObject* from);
  924. tnsShapeObject* tnsDuplicateShappeObject(tnsShapeObject* from);
  925. void tnsInitMeshPlane(tnsMeshObject* mo, real size);
  926. void tnsAddMMeshPlane(tnsMeshObject* mo, real size);
  927. int tnsAnyObjectsSelected(tnsObject* parent);
  928. void tnsDeselectAllObjects(tnsObject* parent);
  929. void tnsSelectAllObjects(tnsObject* parent);
  930. void tnsSelectObject(tnsObject* o, int Select, int Toggle);
  931. #define TNS_MMESH_EDGE_BIT 0x800000
  932. #define TNS_MMESH_FACE_BIT 0xC00000
  933. #define TNS_MMESH_TYPE_BIT (TNS_MMESH_FACE_BIT|TNS_MMESH_EDGE_BIT)
  934. tnsMFace* tnsMMeshNewFace(tnsMeshObject* mo);
  935. tnsMEdge* tnsMMeshNewEdge(tnsMeshObject* mo);
  936. tnsMVert* tnsMMeshNewVert(tnsMeshObject* mo);
  937. void tnsMMeshCalculateNormalFrom(tnsMFace* mf);
  938. int tnsMMeshCalculateNormal(tnsMeshObject* mo);
  939. void tnsMMeshEdgeAssignVerts(tnsMEdge* me,tnsMVert* mv1,tnsMVert* mv2);
  940. tnsMEdge* tnsMMeshVertsShareEdge(tnsMVert* mv0, tnsMVert* mv1);
  941. int tnsMMeshEdgeHasVert(tnsMEdge* me, tnsMVert* MV);
  942. tnsMFace* tnsMMeshEdgeShareFace(tnsMEdge* me0, tnsMEdge* me1);
  943. tnsMVert* tnsMMeshEdgeShareVert(tnsMEdge* me0, tnsMEdge* me1);
  944. tnsMVert* tnsMMeshEdgeAnotherVert(tnsMEdge* me, tnsMVert* v);
  945. tnsMVert* tnsMMeshEdgeStartingVert(tnsMEdge* me0, tnsMEdge* me1);
  946. int tnsMMeshSplitFace(tnsMeshObject* mo, tnsMFace* mf, tnsMEdge* me, tnsMFace** r_f1, tnsMFace** r_f2);
  947. tnsMFace* tnsMMeshVertsShareFace(tnsMVert* v1, tnsMVert* v2);
  948. tnsMEdge* tnsMMeshMakeEdge(tnsMeshObject* mo, tnsMVert* v1, tnsMVert* v2);
  949. void tnsMMeshFaceAddEdge(tnsMFace* mf, tnsMEdge* me);
  950. int tnsMMeshFaceMatches(tnsMFace* mf, int ecount, ...);
  951. tnsMFace* tnsMMeshMakeFaceN(tnsMeshObject* mo, int count, laListHandle* vip, tnsMEdge** r_fallback_me);
  952. tnsMFace* tnsMMeshMakeFace4v(tnsMeshObject* mo, tnsMVert* v1,tnsMVert* v2,tnsMVert* v3,tnsMVert* v4);
  953. int tnsMMeshLoopIsInverted(laListItemPointer* l);
  954. int tnsMMeshEdgeInsertVert(tnsMeshObject* mo, tnsMEdge* me, tnsMVert* mv, tnsMVert* ref_e1v_optional, tnsMEdge** r_e1, tnsMEdge** r_e2);
  955. tnsMVert* tnsMMeshEdgeInsertVertAt(tnsMeshObject* mo, tnsMEdge* me, real at, tnsMVert* ref_e1v_optional, tnsMEdge** r_e1, tnsMEdge** r_e2);
  956. void tnsMMeshRemoveFaceOnly(tnsMeshObject* mo, tnsMFace* mf);
  957. void tnsMMeshRemoveEdgeFace(tnsMeshObject* mo, tnsMEdge* me);
  958. void tnsMMeshRemoveVertEdgeFace(tnsMeshObject* mo, tnsMVert* mv);
  959. void tnsMMeshRefreshIndex(tnsMeshObject* mo);
  960. void tnsMeshEnterEditMode(tnsMeshObject* mo);
  961. void tnsMeshLeaveEditMode(tnsMeshObject* mo);
  962. int tnsMMeshAnySelected(tnsMeshObject* mo);
  963. void tnsMMeshClearExtraFlags(tnsMeshObject* mo);
  964. void tnsMMeshDeselectAll(tnsMeshObject* mo);
  965. void tnsMMeshSelectAll(tnsMeshObject* mo);
  966. void tnsMMeshSelectVert(tnsMeshObject* mo, tnsMVert* mv, int select, int toggle);
  967. void tnsMMeshSelectEdge(tnsMeshObject* mo, tnsMEdge* me, int select, int toggle);
  968. void tnsMMeshEnsureSelectionFromVerts(tnsMeshObject* mo);
  969. void tnsMMeshEnsureSelectionFromEdges(tnsMeshObject* mo);
  970. void tnsMMeshEnsureSelection(tnsMeshObject* mo, int SelectMode);
  971. void tnsMMeshExpandBandList(tnsMeshObject* mo, tnsMEdge* me, laListHandle* lst);
  972. int tnsMMeshSelectRingBandFrom(tnsMeshObject* mo, tnsMEdge* me, int ring_band, int select, int toggle);
  973. int tnsMMeshVertsCanMerge(tnsMeshObject* mo, tnsMVert* into, tnsMVert* mv);
  974. int tnsMMeshMergeVerts(tnsMeshObject* mo, tnsMVert* into, tnsMVert* mv);
  975. void tnsInvalidateMeshBatch(tnsMeshObject* mo);
  976. void tnsRegenerateMeshBatch(tnsMeshObject* mo);
  977. void tnsEnsureMeshBatch(tnsMeshObject* mo);
  978. void tnsEvaluateMeshObject(tnsMeshObject* mo, tnsEvaluateData* ed);
  979. void tnsEvaluateShapeObject(tnsShapeObject* so, tnsEvaluateData* ed);
  980. void tnsShapeSetHole(tnsShape* s, int closed, int toggle);
  981. void tnsShapeSetClosed(tnsShape* s, int closed, int toggle);
  982. int tnsShapePointAnySelected(tnsShape* s);
  983. int tnsShapeAnySelected(tnsShapeObject* so);
  984. void tnsShapeDeselectAll(tnsShapeObject* so);
  985. void tnsShapeSelectAll(tnsShapeObject* so);
  986. void tnsShapeSelectPoint(tnsShapeObject* so, tnsSPoint* sp, int select, int toggle, int lr);
  987. void tnsShapeSelectRingFrom(tnsShapeObject* so, tnsSPoint* sp, int select, int toggle);
  988. void tnsShapeSetEndPoint(tnsShape* s, tnsSPoint* p);
  989. void tnsShapeRefreshIndex(tnsShapeObject* so);
  990. tnsShape* tnsShapeRemovePoint(tnsShapeObject* so, tnsShape* s, tnsSPoint* sp, int SplitShape);
  991. int tnsShapeConnect(tnsShapeObject* so, tnsShape* s1, tnsShape* s2, tnsSPoint* sp1, tnsSPoint* sp2);
  992. int tnsShapeConnectSelected(tnsShapeObject* so);
  993. int tnsShapeExtrudeSelected(tnsShapeObject* so, int DupliOnly);
  994. void tnsShapeEnterEditMode(tnsShapeObject* mo);
  995. void tnsShapeLeaveEditMode(tnsShapeObject* mo);
  996. NEED_STRUCTURE(la3DObjectDrawExtra);
  997. void tnsDrawShapePointsSelectionID(tnsEvaluatedInstance* ei, la3DObjectDrawExtra* de);
  998. void tnsDrawShapeObject(tnsEvaluatedInstance* ei, la3DObjectDrawExtra* de);
  999. void la_RegisterModellingOperators();
  1000. void la_RegisterShapeOperators();
  1001. void tnsGetCameraProjection(tnsMatrix44d* mat, int w, int h, tnsCamera* Camera);
  1002. void tnsGetCameraViewProjection(tnsMatrix44d* mat, int w, int h, tnsCamera* Camera);
  1003. void tnsApplyCameraView(int W, int H, tnsCamera *Camera, tnsMatrix44d out_optional_view, tnsMatrix44d out_optional_projection);
  1004. void tnsApplyShadowCameraView(tnsLight *Light);
  1005. void tnsApplyModelMatrix(tnsMatrix44d m);
  1006. void tnsLookAt(tnsObject *o, tnsVector3d Target, tnsVector3d Up);
  1007. tnsObject* tnsEnsurePlayDuplicate(tnsObject* o);
  1008. void tnsFreePlayDuplicate(tnsObject* o);
  1009. void tnsInvalidateEvaluation(tnsObject* o);
  1010. void tnsInvalidatePlayEvaluation(tnsObject* o);
  1011. void tnsFreeEvaluatedArray(tnsEvaluateData* ed);
  1012. void tnsEvaluateThisObject(tnsObject *o, tnsEvaluateData* ed);
  1013. void tnsSetObjectTreeEvaluationArgs(tnsObject* from, tnsObject* Active, int FillOutline, int FillSelectionID);
  1014. void tnsEvaluateObjectTree(tnsObject* from, tnsEvaluateData* UseED, int EvaluatePlay);
  1015. void tnsAddEvaluatedInstance(tnsEvaluateData* ed, tnsObject* ob, tnsDrawEvaluatedInstanceF Draw, int Layer,
  1016. int IsActive, int MeshSelectionType, int InstanceSelectionID);
  1017. void tnsDrawLayer(tnsEvaluateData* ed,int Layer,void* CustomData);
  1018. void tnsEvaluateNewNode(tnsEvaluateData* ed, tnsObject* ob);
  1019. int tnsEvaluateTryRelinkExistingNode(tnsEvaluateData* ed, tnsObject* ob);
  1020. void tnsEvaluateFreeNode(tnsEvaluatedNode* en);
  1021. void tnsEvaluateSyncNode(tnsEvaluateData* ed, tnsObject* ob);
  1022. void tnsEnsureEvaluatedScene(tnsEvaluateData* ed, tnsObject* root);
  1023. void tnsPrintEvaluatedNode(tnsEvaluatedNode* en,int level);
  1024. void tnsDrawObjectTree(tnsObject* from, int Layers,void* CustomData, int DrawRuntime);
  1025. void tnsDrawObjectOrigins(tnsObject *from, tnsObject *active, int AllOrigins);
  1026. void tnsDrawCursor(tnsObject* root);
  1027. void tnsDrawScene(int W, int H, tnsObject *root);
  1028. void tnsDrawWorld(int W, int H);
  1029. tnsMaterial *tnsCreateMaterial(char *Name);
  1030. tnsMaterial *tnsFindMaterial(char *name);
  1031. tnsMaterialSlot* tnsNewMaterialSlot(tnsMeshObject* mo);
  1032. void tnsRemoveMaterialSlot(tnsMeshObject* mo, tnsMaterialSlot* ms);
  1033. void tnsAssignMaterialSlot(tnsMeshObject* mo, tnsMaterialSlot* ms);
  1034. void tnsRefreshMaterialLibraries();
  1035. void tnsEnsureMaterialShader(tnsMaterial* mat, int Refresh);
  1036. void tnsClearAll();
  1037. void tnsClearColorv(real *rgba);
  1038. void tnsClearColor(real r, real g, real b, real a);
  1039. #ifdef __linux__
  1040. void tnsContextMakeCurrent(SYSGLCONTEXT context, SYSWINDOW win);
  1041. #endif
  1042. #ifdef _WIN32
  1043. void tnsContextMakeCurrent(SYSGLCONTEXT context, SYSTEMDC hdc);
  1044. #endif
  1045. NEED_STRUCTURE(laWindow)
  1046. void tnsSwitchToCurrentWindowContext(laWindow* w);
  1047. void tnsDeleteContext(SYSGLCONTEXT glc);
  1048. void tnsBindVertexArray(GLuint vao);
  1049. void tnsRecalculateVertNormal(tnsVert *v);
  1050. void tnsRecalculateFaceAverageNormal(tnsFace *f);
  1051. int tnsLoadVectorGraphPackage(const char *name, unsigned int size);
  1052. real tnsGetMonoFontAdvance();
  1053. int tnsInvalidateFontCache();
  1054. int tnsLoadSystemFontMono(char* from, char* mono);
  1055. int tnsLoadSystemFont(char* from, char* name);
  1056. int tnsGetTextureMemoryComponetCount(tnsTexture *t);
  1057. void tnsUseNormal(int Use);
  1058. void tnsUseHalftone(real Use);
  1059. void tnsUniformUseOffset(tnsShader* s, int use);
  1060. tnsImage* tnsNewImage(void* MemPNG);
  1061. void tnsUseImage(tnsImage* im);
  1062. void tnsStopUsingImage(tnsImage* im);
  1063. void tnsSetRayShaderUniformTextures(tnsOffscreen* doff);
  1064. int tnsInit2DTexture(tnsTexture *t, GLint glInternalFormat, int w, int h, int Multisample);
  1065. tnsTexture *tnsCreate2DTexture(GLint glInternalFormat, int w, int h, int Multisample);
  1066. tnsTexture *tnsCreate3DTexture(GLint glInternalFormat, int w, int h, int slices);
  1067. void tnsConfigure2DTexture(tnsTexture *t);
  1068. void tnsConfigure3DTexture(tnsTexture *t);
  1069. void tnsReconfigureTextureParameters(int Multisample);
  1070. tnsOffscreen *tnsCreate2DOffscreen(int glInternalFormat, int w, int h, int Multisample, int WithDepth, int WithStencil);
  1071. tnsOffscreen *tnsCreateDeferredOffscreen(int w, int h, int Multisample);
  1072. void tnsCopyScreenTo2DTexture(tnsTexture *target, int x_lower_left, int y_lower_left, int w, int h);
  1073. void tnsActiveTexture(GLenum tex);
  1074. void tnsBindTexture(tnsTexture *t);
  1075. void tnsUnbindTexture();
  1076. void tnsUniformUseNormal(tnsShader* s, int Use);
  1077. void tnsUniformUseHalftone(tnsShader* s, real Use);
  1078. void tnsUniformHalftoneSize(tnsShader* s, real Use);
  1079. void tnsUniformUseTexture(tnsShader* s, int mode, int sample);
  1080. void tnsUniformColorMode(tnsShader *s, int mode);
  1081. void tnsUniformHCYGamma(tnsShader* s, float Gamma);
  1082. void tnsUniformInputColorSpace(tnsShader* s, int ColorSpace);
  1083. void tnsUniformOutputColorSpace(tnsShader* s, int ColorSpace);
  1084. void tnsUniformShowColorOverflowStripes(tnsShader* s, int Show);
  1085. void tnsUniformColorComposing(tnsShader* s, int Composing, real gamma, real blackpoint);
  1086. void tnsUniformUseMultiplyColor(tnsShader* s, int enable);
  1087. void tnsUseMaskTexture(tnsTexture *t);
  1088. void tnsUseTexture(tnsTexture *t);
  1089. void tnsUseNoTexture();
  1090. void tnsUseMultiplyColor(int enable);
  1091. void tnsDeleteTexture(tnsTexture *t);
  1092. void tnsDraw2DTextureDirectly(tnsTexture *t, real x, real y, real w, real h);
  1093. void tnsDraw2DTextureArg(tnsTexture *t,
  1094. real x_upper_right, real y_upper_right, int w, int h,
  1095. real *MultiplyColor,
  1096. real LPadding, real RPadding, real TPadding, real BPadding);
  1097. int tnsTextureMemorySize(tnsTexture *t, int mem);
  1098. void tnsDelete2DOffscreen(tnsOffscreen *o);
  1099. tnsOffscreen *tnsCreateOffscreenHandle();
  1100. void tnsEnsureOffscreenStatus(tnsOffscreen *off, int w, int h);
  1101. void tnsAttach2DOffscreenBuffer(tnsOffscreen *target, GLuint attatchment, tnsTexture *use);
  1102. void tnsDetach2DOffscreenBuffer(tnsOffscreen *target, GLuint which_attach_point);
  1103. void tnsDrawToOffscreen(tnsOffscreen *toff, int HowMany, GLuint *AttachmentArray);
  1104. void tnsDrawToExtraColorAttachment(tnsOffscreen *toff);
  1105. void tnsDrawToExtraNormalAttachment(tnsOffscreen *toff);
  1106. void tnsDrawToAllExtraAttachments(tnsOffscreen *toff);
  1107. void tnsDrawToOffscreenOnlyBind(tnsOffscreen *toff, int HowMany, GLuint *AttachmentArray);
  1108. void tnsReadFromOffscreen(tnsOffscreen *toff);
  1109. void tnsPassColorBetweenOffscreens(tnsOffscreen *from, tnsOffscreen *to,
  1110. GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLenum FilterMode);
  1111. void tnsDrawToScreen();
  1112. //==============================================[STR]
  1113. int tnsUseFont(char *name);
  1114. int laStopFontService();
  1115. void tfntResizeFontTexture(tnsFont* f, int size);
  1116. int tnsStringGetDimension(char* content, uint32_t* contentU, int Count, int WLimit, int* Rows, int UseMono);
  1117. int tnsStringGetWidth(char *content, int Count, int UseMono);
  1118. int tnsStringGetWidthU(uint32_t *contentU, int Count, int UseMono);
  1119. void tnsDrawStringM(char *content, uint32_t* contentU, real Color[4], int L, int R, int T, int Flags);
  1120. int tnsDrawLCD7_ProgressSystem(real x, real y, real Percent);
  1121. void tnsDrawStringLCD(char *content, uint32_t* contentU, real Color[4], int L, int R, int T, int Flags, real Scale);
  1122. void tnsDrawStringAutoM(char *content, uint32_t* contentU, real Color[4], int L, int R, int T, int Flags);
  1123. void tnsDrawStringAuto(char *content, real Color[4], int L, int R, int T, int Flags);
  1124. void tnsDrawStringWithPriority(char *Label, char *MajorContent, real Color[4], int TextAlign, int L, int R, int T, int Flags);
  1125. void tnsDrawVectorGraphPackage(int ID, real Color[4], int L, int R, int T, int B, int Align, int Flags);
  1126. void tnsDrawIcon(uint32_t ID, real Color[4], int L,int R, int T, int Flags);
  1127. void tnsUseFontCoord(real x, real y, real size);
  1128. ///=================================
  1129. void tnsMakeTriangle(real *arr, real x1, real y1, real x2, real y2, real x3, real y3);
  1130. void tnsMakeQuad2d(real *arr, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4);
  1131. void tnsMakeQuadT2d(real *arr, real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4);
  1132. void tnsMakeQuad3d(real *arr, real x1, real y1, real z1, real x2, real y2, real z2, real x3, real y3, real z3, real x4, real y4, real z4);
  1133. void tnsMakeQuad4d(real *arr, real x1, real y1, real z1, real w1, real x2, real y2, real z2, real w2, real x3, real y3, real z3, real w3, real x4, real y4, real z4, real w4);
  1134. void tnsMakeCircle2d(real *arr, int slices, real ctrX, real ctrY, real r, int jump);
  1135. void tnsMakeArc2d(real *arr, int slices, real ctrX, real ctrY, real r, real rad_begin, real rad_end);
  1136. void tnsMakeRing2d(real *arr, int *index, int slices, real ctrX, real ctrY, real r1, real r2);
  1137. void tnsMakeLinerGradient3d(real *arr, int num_points, real r0, real g0, real b0, real r1, real g1, real b1);
  1138. void tnsMakeLinerGradient4d(real *arr, int num_points, real r0, real g0, real b0, real a0, real r1, real g1, real b1, real a1);
  1139. void tnsMakeLinerGradient3dv(real *arr, int num_points, real *rgb0, real *rgb1);
  1140. void tnsMakeLinerGradient4dv(real *arr, int num_points, real *rgb0, real *rgb1);
  1141. void tnsMakeFoucsSquare(int L, int R, int U, int B, int W);
  1142. void tnsDrawFloor(real* CamPosition, real Far, int *ShowAxis);
  1143. void tnsDraw2DGrid10(real L, real R, real U, real B, real xmin, real xmax, real ymin, real ymax, real MostDenseW, real MostDenseH,
  1144. real* color4, real AlphaFactor, int ShowGrid, int TextAlign);
  1145. void tnsMakeIndexUInt(unsigned int *result, int num, ...);
  1146. void tnsMakeBridgedIndex(unsigned int *result, int num, int revert, int begin);
  1147. //================================
  1148. void DrawWireRect2dp(real x, real y, real x2, real y2);
  1149. void tnsViewportWithScissor(int x, int y, int w, int h);
  1150. void tnssRGB2XYZ(tnsVector3d rgb,tnsVector3d xyz);
  1151. void tnsClay2XYZ(tnsVector3d rgb,tnsVector3d xyz);
  1152. void tnsXYZ2sRGB(tnsVector3d xyz,tnsVector3d rgb);
  1153. void tnsXYZ2Clay(tnsVector3d xyz,tnsVector3d rgb);
  1154. void tnsRGB2Clay(tnsVector3d rgb, tnsVector3d clay);
  1155. void tnsClay2RGB(tnsVector3d clay, tnsVector3d rgb);
  1156. void tns2LogsRGBSingle(real* a);
  1157. void tns2LinearsRGBSingle(real* a);
  1158. void tns2LogsRGB(real* srgb);
  1159. void tns2LinearsRGB(real* srgb);
  1160. void tnsRGB2OKLAB(real* rgb, real* oklab);
  1161. void tnsOKLAB2RGB(real* oklab, real* rgb);
  1162. void tnsHCY2RGBLinear(real *hcy, real *rgb);
  1163. void tnsRGB2HCYLinear(real *rgb, real *hcy);
  1164. void tnsHCY2RGB(real *hcy, real *rgb);
  1165. void tnsRGB2HCY(real *rgb, real *hcy);
  1166. void tnsRGB2HSL(real *rgb, real *hsl);
  1167. void tnsHSL2RGB(real *hsl, real *rgb);
  1168. #ifdef __cplusplus
  1169. extern "C"{
  1170. #endif
  1171. extern const char* LA_TNS_LIB_COMMON;
  1172. #ifdef __cplusplus
  1173. }
  1174. #endif