*/}}
1
0

la_tns.h 48 KB

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