Hi,
I'm trying to add this to my own project with A7. I've converted the CScript code to lite-C and I noticed that when I try to enable the effects, the framerate drops but the effects don't show up? Here's my code:
PP_Effects.c:
Code:
#include "main.h"
// Blur in all directions (Lowquality)
MATERIAL* SimpleBlur_mat =
{
effect = "simpleBlur.fx";
}
function SimpleBlur_set_Value(Blur)
{
SimpleBlur_mat.skill1 = floatv(Blur); // should be higher than 1
}
// Blur in all directions (Highquality)
MATERIAL* ComplexBlur_mat =
{
effect = "complex_blur.fx";
}
function ComplexBlur_set_Value(Blur)
{
ComplexBlur_mat.skill1 = floatv(Blur); // should be very small between 0.001 and 0.05
}
PP_Main.c:
Code:
#include "PP_Effects.c"
VIEW* PP_Cam;
BMAP* ppe_quad = "graphics/PPE_Quad.tga";
ENTITY* PP_Quad =
{
type = ppe_quad;
layer = 1;
view = camera;
flags = VISIBLE;
x = 10;
y = 0;
z = 0;
scale_x = 1;
scale_y = 1;
}
function PP_Init_startup()
{
PP_Cam = view_create(1);
PP_Cam.bmap = bmap_for_entity(PP_Quad,0);
}
function PP_Init_Effect()
{
PP_Quad.material = ComplexBlur_mat;//Change this to the material you wish<---------------------------
ComplexBlur_set_Value(9.0); //Call here the function to set the materials values<-------------
}
function PP_Toggle_OnOff()
{
if(PP_Quad.flags & VISIBLE)
{
PP_Cam.flags &= ~VISIBLE;
PP_Quad.flags &= ~VISIBLE;
}else
{
camera.flags |= VISIBLE;
PP_Cam.flags |= VISIBLE;
PP_Quad.flags |= VISIBLE;
while(PP_Quad.flags & VISIBLE)
{
vec_set(PP_Cam.x,camera.x);
vec_set(PP_Cam.pan,camera.pan);
wait(1);
}
}
}
And in main.c I added:
Code:
PP_Init_Effect();
PP_Toggle_OnOff();
on_z = PP_Toggle_OnOff;
Thans.