3DCoat  3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Utils.h File Reference
#include "../ClassEngine/stackarray.h"
#include "ScopedTimer.h"

Classes

class  CallItLater
 

Macros

#define TEST_SUIT   3
 Run after init render, shaders etc. More...
 
#define __onstartup(suffix)   static void fn##suffix();static CallItLater lt##suffix(&fn##suffix);static void fn##suffix()
 
#define __afterinit(suffix)   static void fn_after_init_##suffix();static CallItLater lt_after_init_##suffix(&fn_after_init_##suffix,TEST_SUIT);static void fn_after_init_##suffix()
 
#define __preprocess(suffix)   static void fn_preprocess##suffix();static CallItLater lt_preprocess##suffix(&fn_preprocess##suffix,PRE_PROCESS);static void fn_preprocess##suffix()
 
#define __prerender(suffix)   static void fn_prerender##suffix();static CallItLater lt_prerenders##suffix(&fn_prerender##suffix,PRE_RENDER);static void fn_prerender##suffix()
 
#define __postprocess(suffix)   static void fn_postprocess##suffix();static CallItLater lt_postprocess##suffix(&fn_postprocess##suffix,POST_RENDER);static void fn_postprocess##suffix()
 
#define __postrender(suffix)   static void fn_postrender##suffix();static CallItLater lt_postrender##suffix(&fn_postrender##suffix,POST_RENDER);static void fn_postrender##suffix()
 
#define __afterui(suffix)   static void fn_afterui##suffix();static CallItLater lt_afterui##suffix(&fn_afterui##suffix,POST_UI);static void fn_afterui##suffix()
 
#define __thumbnail(suffix)   static void fn_thumbnail##suffix();static CallItLater lt_thumbnail##suffix(&fn_thumbnail##suffix,POST_RENDER);static void fn_thumbnail##suffix()
 
#define __aftersettings(suffix)   static void fn_afterset##suffix();static CallItLater lt_afterset##suffix(&fn_afterset##suffix,AOPPOPT_READY);static void fn_afterset##suffix()
 
#define __onnew(suffix)   static void fn_onnew##suffix();static CallItLater lt_onnew##suffix(&fn_onnew##suffix,ON_NEW);static void fn_onnew##suffix()
 
#define __onkey(suffix)   static void fn_onkey##suffix();static CallItLater lt_onnew##suffix(&fn_onkey##suffix,ON_KEY);static void fn_onkey##suffix()
 
#define __ondropfile(suffix)   static void fn_ondropfile##suffix();static CallItLater lt_ondropfile##suffix(&fn_ondropfile##suffix,CBDROPFILE);static void fn_ondropfile##suffix()
 

Typedefs

typedef float sort_projection (const void *ptr)
 sorting routines the function returns projection of the element to float axis More...
 
typedef int i_sort_projection (const void *ptr)
 the function returns projection of the element to integer space More...
 

Functions

const char * GetSpaces (int count)
 returns permanant pointer to given amount of spaces More...
 
void DrawPicture (const Rct &rect, int Texture, DWORD Color, bool Shadow)
 draw picture More...
 
void CreateControlWithBaseClass (BaseWidget *W, Rct &Rect, const char *FieldName, BaseClass *Parent, BaseClass *Class, void *Ptr=NULL, void *Extra=NULL, const char *id=NULL, float *ExMargin=nullptr)
 
void EigenSolve3x3 (const Matrix3D &A, Vector3D *Vecs, float *vals)
 EigenSolve3x3 seeks for eigen vectors and values of 3x3 matrix, Vecc and vals - pointers to arrays of 3 elements. More...
 
void __removeit ()
 __removeit() - call it within any of __preprocess ... __thumbnail if you no longer need to call this event/trigger More...
 
bool CheckKeyAvailable (const char *key)
 Call this function if you need to know if some key registered in 3D-Coat. User may register keys using Help->Install plugin license. More...
 
void Mosaic2X (comms::cImage &im)
 icons job More...
 
Vector3D ToRealXYZ (const Vector3D &p)
 convert from inner VECTOR (y-up) to visible representation (y-up or z-up) More...
 
float GetBicubic (float u, float v, const Matrix4D &V)
 GetBicubic performs bicubic interpolation. More...
 
void psort (void *data, int N, int typesize, sort_projection *sp)
 float key sorting, thread unsafe More...
 
void psort (void *vdata, float *values, int N, int typesize)
 thread-save verson of float sorting More...
 
void psort (void *vdata, double *values, int N, int typesize)
 thread-save verson of double sorting More...
 
void psort (void *data, int N, int typesize, i_sort_projection *sp)
 integer key sorting, thread unsafe More...
 
void psort (void *vdata, int *keys, int N, int typesize)
 thread-save verson of integer sorting More...
 
void memswap (void *memory1, void *memory2, size_t extent)
 swap memory ranges More...
 
bool ismemb (const char *FullXmlID, const char *ShortName)
 returns true if ShortName is the part of FullXmlID, usually used in OnChangeMember to identify the member More...
 
int mat_icon (const char *id)
 Returns Texture id for icons in material.io folder. You need to pass the icon name without extension or file path, just raw name. More...
 
cStr CopyFileToFolderWithUniqueName (const char *filename, const char *destfolder, const char *extra_ext)
 Copy file to folder, check if file exists, create unique name if file already exists and content is different. More...
 
void Create3dcpack (const char *destfile, const StringsList &FilesList)
 Create 3dcpack file (zipped files set) from the list of files (only relative paths!!!) More...
 

Macro Definition Documentation

#define __afterinit (   suffix)    static void fn_after_init_##suffix();static CallItLater lt_after_init_##suffix(&fn_after_init_##suffix,TEST_SUIT);static void fn_after_init_##suffix()

Call it after tools, graphics and shaders initialisation.

#define __aftersettings (   suffix)    static void fn_afterset##suffix();static CallItLater lt_afterset##suffix(&fn_afterset##suffix,AOPPOPT_READY);static void fn_afterset##suffix()

Call it once after settings loading.

#define __afterui (   suffix)    static void fn_afterui##suffix();static CallItLater lt_afterui##suffix(&fn_afterui##suffix,POST_UI);static void fn_afterui##suffix()

Call it once per frame, after the ui rendering, before the topmost elements

#define __ondropfile (   suffix)    static void fn_ondropfile##suffix();static CallItLater lt_ondropfile##suffix(&fn_ondropfile##suffix,CBDROPFILE);static void fn_ondropfile##suffix()

Call if file dropped using drag&drop, filename is in Widgets::LastDroppedFile. Set it empty if you acquired the file.

#define __onkey (   suffix)    static void fn_onkey##suffix();static CallItLater lt_onnew##suffix(&fn_onkey##suffix,ON_KEY);static void fn_onkey##suffix()

Call it as soon as user pressed the key, get the key value from Widgets::lastKey. Set it to 0 if the key captured and des not need to be propagated anymore.

#define __onnew (   suffix)    static void fn_onnew##suffix();static CallItLater lt_onnew##suffix(&fn_onnew##suffix,ON_NEW);static void fn_onnew##suffix()

Call it as soon as user starts new scene.

#define __onstartup (   suffix)    static void fn##suffix();static CallItLater lt##suffix(&fn##suffix);static void fn##suffix()

Call on startup, right before tools initialisation.

#define __postprocess (   suffix)    static void fn_postprocess##suffix();static CallItLater lt_postprocess##suffix(&fn_postprocess##suffix,POST_RENDER);static void fn_postprocess##suffix()

Call it once per frame, after tools processing.

#define __postrender (   suffix)    static void fn_postrender##suffix();static CallItLater lt_postrender##suffix(&fn_postrender##suffix,POST_RENDER);static void fn_postrender##suffix()

Call it once per frame, after the rendering stage.

#define __preprocess (   suffix)    static void fn_preprocess##suffix();static CallItLater lt_preprocess##suffix(&fn_preprocess##suffix,PRE_PROCESS);static void fn_preprocess##suffix()

Call it once per frame, before tools processing.

#define __prerender (   suffix)    static void fn_prerender##suffix();static CallItLater lt_prerenders##suffix(&fn_prerender##suffix,PRE_RENDER);static void fn_prerender##suffix()

Call it once per frame, before the rendering stage.

#define __thumbnail (   suffix)    static void fn_thumbnail##suffix();static CallItLater lt_thumbnail##suffix(&fn_thumbnail##suffix,POST_RENDER);static void fn_thumbnail##suffix()

Call it once per frame to draw thumbnails.

#define TEST_SUIT   3

Run after init render, shaders etc.

Typedef Documentation

typedef int i_sort_projection(const void *ptr)

the function returns projection of the element to integer space

typedef float sort_projection(const void *ptr)

sorting routines the function returns projection of the element to float axis

Function Documentation

void __removeit ( )

__removeit() - call it within any of __preprocess ... __thumbnail if you no longer need to call this event/trigger

bool CheckKeyAvailable ( const char *  key)

Call this function if you need to know if some key registered in 3D-Coat. User may register keys using Help->Install plugin license.

cStr CopyFileToFolderWithUniqueName ( const char *  filename,
const char *  destfolder,
const char *  extra_ext 
)

Copy file to folder, check if file exists, create unique name if file already exists and content is different.

void Create3dcpack ( const char *  destfile,
const StringsList FilesList 
)

Create 3dcpack file (zipped files set) from the list of files (only relative paths!!!)

void DrawPicture ( const Rct &  rect,
int  Texture,
DWORD  Color,
bool  Shadow 
)

draw picture

void EigenSolve3x3 ( const Matrix3D A,
Vector3D Vecs,
float *  vals 
)

EigenSolve3x3 seeks for eigen vectors and values of 3x3 matrix, Vecc and vals - pointers to arrays of 3 elements.

float GetBicubic ( float  u,
float  v,
const Matrix4D V 
)

GetBicubic performs bicubic interpolation.

Parameters
u- x-coordinate, [0..1]
v- y-coordinate, [0..1]
V- matrix of 16 neighbours values of the required interval, should be filled as
for(int y=0; y<4; y++) {
for(int x=0; x<4; x++) {
m[y][x] = MapOfValues(x0 + x - 1, y0 + y - 1);
}
}
Returns
bicubic interpolated value
const char* GetSpaces ( int  count)

returns permanant pointer to given amount of spaces

bool ismemb ( const char *  FullXmlID,
const char *  ShortName 
)

returns true if ShortName is the part of FullXmlID, usually used in OnChangeMember to identify the member

Referenced by QuadragulationTask::OnChangeMember(), and VoxTreeBranch::OnChangeMember().

int mat_icon ( const char *  id)

Returns Texture id for icons in material.io folder. You need to pass the icon name without extension or file path, just raw name.

Referenced by CreateControlWithBaseClass(), SmartMatWindow::GetIconInActivityBar(), iconic_submenu(), VoxTreeBranch::OnModifyControl(), and ui_icon().

void memswap ( void *  memory1,
void *  memory2,
size_t  extent 
)

swap memory ranges

Referenced by psort().

void Mosaic2X ( comms::cImage &  im)

icons job

Referenced by OneFacture::ActualizePreview().

void psort ( void *  data,
int  N,
int  typesize,
sort_projection sp 
)

float key sorting, thread unsafe

Referenced by psort().

void psort ( void *  vdata,
float *  values,
int  N,
int  typesize 
)

thread-save verson of float sorting

References memswap(), and psort().

void psort ( void *  vdata,
double *  values,
int  N,
int  typesize 
)

thread-save verson of double sorting

References memswap(), and psort().

void psort ( void *  data,
int  N,
int  typesize,
i_sort_projection sp 
)

integer key sorting, thread unsafe

References psort().

void psort ( void *  vdata,
int *  keys,
int  N,
int  typesize 
)

thread-save verson of integer sorting

References memswap(), and psort().

Vector3D ToRealXYZ ( const Vector3D p)

convert from inner VECTOR (y-up) to visible representation (y-up or z-up)