aboutsummaryrefslogtreecommitdiff
path: root/libexe/shaveSDKCALLBACKS.h
blob: c310d5100927f3a6c976d86dd026df10e01ef5b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef shaveSDKCALLBACKS_h
#define shaveSDKCALLBACKS_h

// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include "shaveSDKTYPES.h"

#ifndef USECPP
#ifdef __cplusplus
extern "C"
{
#endif
#endif

// This is where you want to put display update, I've finished a tile, show it
extern void SHAVEdraw_tile_callback(VERT *a,VERT *b) ;

// Callback functions (shave calls you)

extern float    SHAVEapply_falloff( int lightNUM, VERT pos, float cone );

// SHAVEapply_GI needs to be in the special softimage namespaces
// so do not delcare it here, declare it in shaveSDKFUNC.h
#ifndef XSI_SOFT3D_ONLY
VERT            SHAVEapply_GI( VERT vv, CURVEINFO * ci );
#endif

// Returns global illumination at the specified position in space.

extern void     SHAVEapply_inst_color( WFTYPE * instance_geom, int hairID, int slgID, unsigned long shaveINSTID );

extern VERT     SHAVEdisplace_root( VERT * root, CURVEINFO * ci, int ID );

// this is usedfull for subdiv surfaces. You return a vector to displace
// the whole hair by (should be the difference between the position on the
// subdiv and root

extern int      SHAVEprogress( int actual, int estimated_total );

// this function gets called every 100 hairs (when rendering)
// so that you can make a progress bar. Estimated total is the number of times
// this function should get called during a render
// if you want to cancell the render you should return killit==1 for the rest of
// the calls to this function until the render releases control

extern void     SHAVEcoord_convertTOSHAVE( VERT * in );

// if this function is empty then all data is MAYAcentric or SOFTIMAGEcentric
// here's how you convert for lightwave & cinema4d:
//in->z = -in->z;
//SHAVEflip_normals();
// here's how you convert for max (I think):
// VERT swap;
// swap.x= in->x;
// swap.z= in->y;
// swap.y= in->z;
// swap.z= -swap.z;
//in->x = swap.x;
//in->y = swap.y;
//in->z = swap.z;
//SHAVEflip_normals();

extern void     SHAVEcoord_convertFROMSHAVE( VERT * in );

// if this function is empty then all data is MAYAcentric or SOFTIMAGEcentric
// here's how you convert for lightwave & cinema4d:
//in->z = -in->z;
//SHAVEflip_normals();
// here's how you convert for max (I think):
// VERT swap;
// swap.x= in->x;
// swap.z= in->y;
// swap.y= in->z;
// swap.z= -swap.z;
//in->x = swap.x;
//in->y = swap.y;
//in->z = swap.z;
//SHAVEflip_normals();

float           SHAVEapply_texture( CURVEINFO * ci, VERT rest_root_worldpos, unsigned long shaveINSTID, int parm, float inbound_value );

// this function callback gives you the opportunity to apply external
// texture to any/every channel in shave
// CURVEINFO contains all kinds of basis information
// rest_root_worldpos is the world coord for the hair's root in the rest
// position
// shaveINSTID contains the ID you burned the restMEM (at creation) that's 
// being rendered 
// parm tells you which channel is being evaluated from SHAVEPARMS
// this function is called during rendering
// inbound contains the param value as evaluated internally (slider *
// weight * texture)
// do something to inbound value here before it's returned


// this needs to be here as well, but you won't be using it
// the 'MAYA' in the name is due to back compatibility with a MAYAShave version
extern void     MAYAexternal_forces( VERT * lastpos, VERT * velocity, int y );
extern void	MAYAcache_forces(int clearCache);
extern void	MAYAapply_cached_forces(int guideNum, int vertNum, VERT* velocity);
extern void     MAYAexternal_collision( SOFTGUIDE * lastpos, SOFTGUIDE * vect, float seglen );

// this is an illumination callback (see docs)
extern VERT     SHAVEapply_illumination( int LIGHTID, VERT wpos, VERT vector, VERT color );

// ranges are 0.0 - 1.0 (return isn't clipped until after shading)
// modify or replace 'color' - it contains light info for current test before
// shave shadows are applied


extern void     SHAVEapply_illuminationWF( int LIGHTID, WFTYPE * samples );

// ranges are 0.0 - 1.0 (return isn't clipped until after shading)
// modify or replace 'samples->color' - it contains light info for current test before
// shave shadows are applied
// samples->v is the position
// samples->totalverts is the total number of points
//  return(samples);



// this is a callback for applying atmospherics/depth cueing
extern VERT     SHAVEapply_atmosphere( VERT wpos, VERT inbound_color );

// range = 0.0 - 1.0 (shave will clip out of bound returns)
// do your tint here based on wpos
// here's how:
// fogval=your_compute_func_for_fog(wpos);
// if (fog_val>1.0) fog_val=1.0;
// if (fog_val<0.0) fog_val=0.0;
//  inbound_color.x=inbound_color.x*(1.0-fog_val)+fog_color.x*fog_val;
//  inbound_color.y=inbound_color.y*(1.0-fog_val)+fog_color.y*fog_val;
//  inbound_color.z=inbound_color.z*(1.0-fog_val)+fog_color.z*fog_val;

extern float    SHAVEapply_VMAP( long SHAVEINSTID, int VERTID, int chan, float inbound_value );

// this function callback gives you the opportunity to apply external
// vertpaint to any/every channel in shave
// normally the inbound_value will be 1.0 (unless you've painted a map
// inside shave)
// the return, should contain a value who's range is (float) 0-1

extern void	SHAVEdraw_tile_callback(VERT *a, VERT *b);

// this function is called by shave after each tile has finished rendering.

#ifndef USECPP
#ifdef __cplusplus
}
#endif
#endif

#endif /* shaveSDKCALLBACKS_h */