Hi guys, please, anybody help me. I wrote surface shader. but cant compile it. VCC send me the message “myShop.vfl: Error 1091: No context function defined.”
vfl file:
#include “my_shoplib.h”
#include “math.h”
#define VOP_SHADING
#define VOP_SURFACE
#pragma opname my_Shader
#pragma oplabel “My Shader”
surface
myShop( export vector paintExport = {0,0,0};
export vector diffuseExport = {0,0,0};
vector clr = {1,1,1};
vector opasity = {1,1,1};
float intensity = 1;
float rough = 0.1;
string _diff_lightmask_ = “*”;
string _diff_categories_ =“-”;
int useFaceFwd = 1; )
{
vector _clr = clr*opasity;
vector _diff = 0;
paintExport = _clr;
if (intensity > 0)
{
_diff = my_diffuseBRDF(N, useFaceFwd, intensity, rough, _diff_lightmask_, _diff_categories_);
_clr *= _diff;
diffuseExport = _clr;
}
Cf = _clr;
Of = opasity;
}
.h file:
#ifndef _MY_SHOPLIB_
#define _MY_SHOPLIB_
@define MY_PI 3.1415926
@define MY_PI_2 1.5707963
@define LIGHT_AMBIENT 0x01
@define LIGHT_DIFFUSE 0x02
@define LIGHT_SPECULAR 0x04
@define LIGHT_DIFFSPEC (LIGHT_DIFFUSE/LIGHT_SPECULAR)
vector my_diffuseBRDF(vector nn; int useFaseFwd; float intensity, roughness; string _lightmask_, _categories_)
{
vector illum = 0;
if (intensity > 0)
{
vector nN = normalise (nn);
vector nI = normalise (I);
vector V = -nI;
if (useFaseFwd > 0)
{
nN = frontface(nN,nI);
}
illuminance (P,nN,MY_PI_2,LIGHT_DIFFUSE, “lightmask”, _lightmask_, “categories”, _categories_)
{
vector nL = normalise (L);
shadow(Cl);
illum += Cl*diffuseBRDF(nL,nN,V,roughness);
}
illum *= intensity;
}
return illum;
}
#endif
vcc compiling error
2150 2 1- Vladimir Harchenko
- Member
- 5 posts
- Joined: April 2015
- Offline
- halfdan
- Member
- 599 posts
- Joined: May 2011
- Offline
Vladimir Harchenko
@define MY_PI 3.1415926
@define MY_PI_2 1.5707963
@define LIGHT_AMBIENT 0x01
@define LIGHT_DIFFUSE 0x02
@define LIGHT_SPECULAR 0x04
@define LIGHT_DIFFSPEC (LIGHT_DIFFUSE/LIGHT_SPECULAR)
For some reason those @defines seem to be terminating the parsing without an error or a warning, and then the compiler decides that it hasn't declared a context function due to it. Change those to #define and it'll compile the rest of the file (albeit with errors).
We'll fix the parser.
Halfdan Ingvarsson
Senior Developer
Side Effects Software Inc
Senior Developer
Side Effects Software Inc
- Vladimir Harchenko
- Member
- 5 posts
- Joined: April 2015
- Offline
-
- Quick Links