namespace HDK_Sample {
const char *vert_shader =
"#version 150 \n"
"uniform mat4 glH_ProjectMatrix; \n"
"uniform mat4 glH_ViewMatrix; \n"
"in vec3 P; \n"
"in vec3 Cd; \n"
"out vec4 clr; \n"
"void main() \n"
"{ \n"
" clr = vec4(Cd, 1.0); \n"
" gl_Position = glH_ProjectMatrix * glH_ViewMatrix * vec4(P, 1.0); \n"
"} \n";
const char *frag_shader =
"#version 150 \n"
"in vec4 clr; \n"
"out vec4 color; \n"
"void main() \n"
"{ \n"
" color = clr; \n"
"} \n";
{
public:
myShader(NULL)
{}
~DM_SceneBoundsRenderHook() override
{ delete myShader; }
{
return false;
}
{
int i;
bool init = false;
for(i=0; i<viewport().getNumOpaqueObjects(); i++)
{
gd = viewport().getOpaqueObject(i);
{
if(!init) scene_box = box;
init = true;
}
}
for(i=0; i<viewport().getNumTransparentObjects(); i++)
{
gd = viewport().getTransparentObject(i);
{
if(!init) scene_box = box;
init = true;
}
}
for(i=0; i<viewport().getNumUnlitObjects(); i++)
{
gd = viewport().getUnlitObject(i);
{
if(!init) scene_box = box;
init = true;
}
}
if(!init)
return;
createBoundingBox(scene_box, opts->
common().defaultWireColor(),
pos, col);
if(!myShader)
{
"vertex", 0);
"fragment", 0);
myShader->linkShaders(r);
}
}
{
}
private:
};
{
public:
DM_SceneBoundsHook() :
DM_SceneHook(
"Scene Bounding Box", 0,
{}
{
return new DM_SceneBoundsRenderHook(vport);
}
{
delete hook;
}
};
}
using namespace HDK_Sample;
void
{
}