#include <default.c>
STRING* sDrawTxt1;
STRING* sDrawTxt2;
void uu1ViewCheck(){
switch(uu1){
case 0:
sDrawTxt1="0 - Box is fully outside the view frustum.";
break;
case 1:
sDrawTxt1="1 - Box is partially inside the view frustum.";
break;
case 2:
sDrawTxt1="2 - Box is fully inside the view frustum.";
break;
}
}
void uu2ViewCheck(){
switch(uu2){
case 0:
sDrawTxt2="0 - Point is fully outside the view frustum.";
break;
case 1:
sDrawTxt2="1 - Point is partially inside the view frustum.";
break;
case 2:
sDrawTxt2="2 - Point is fully inside the view frustum.";
break;
}
}
void main()
{
video_aspect = 4./3.;
level_load(0);
wait(2);
vec_set(camera.x,vector(0,0,10));
vec_set(camera.pan,vector(-10,-20,0));
camera.clip_near = 1;
camera.clip_far = 60;
camera.arc = 90;
def_debug();
int i=2;
while (1){
uu1ViewCheck();uu2ViewCheck();
draw_box3d(vector(-4,-4,-4), vector(4,4,4), COLOR_GREEN, 100);
draw_point3d(vector(0,-30,0), COLOR_RED, 100, 1);
if(uu1 = view_check(camera,vector(-4,-4,-4),vector(4,4,4))){}
draw_text(sDrawTxt1,5,120, COLOR_GREEN);
if(uu2 = view_check(camera,vector(0,-30,0),vector(0,-30,0))){}
draw_text(sDrawTxt2,5,140, COLOR_RED);
if(camera.x <= -90) i=-2;
if(camera.x >= 30) i= 2;
camera.x -= i * time_step;
camera.x = clamp (camera.x,-90,30);
wait(1);
}
}