*/}}
1
0

la_tns.h 48 KB

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