1 registered members (AndrewAMD),
609
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_decal and particle material V7.10
#221213
08/12/08 19:59
08/12/08 19:59
|
Joined: Jan 2007
Posts: 651 Germany
RedPhoenix
OP
User
|
OP
User
Joined: Jan 2007
Posts: 651
Germany
|
Hi conitec, I create a decal in a while (1) loop for visualising a mouse selection radius. I use this code: vec_set(temp_vec,camera.x);
vec_set(temp2_vec,mouse_dir3d);
vec_scale(temp2_vec,5000);
vec_add(temp_vec,temp2_vec);
you = NULL;
result = c_trace(camera.x,temp_vec,IGNORE_YOU|IGNORE_PASSABLE|USE_POLYGON | SCAN_TEXTURE);
if (you != my || result == 0) { wait(1); continue; }
my_pp = ent_decal(my,sel_rad,pencil_vars[0],0); my_pp.lifespan = 0.001;
my_pp.material = decal_mat;
my_pp is a local PARTICLE* pointer. decal_mat looks like this: MATERIAL* decal_mat = {
ambient_red = 255;
ambient_green = 255;
ambient_blue = 255;
} I create the decals on a terrain that uses a multitexturing shader. At the beginning of my test the decal looks all right. Then I change the shader of the terrain (it's cloned by the way) using effect_load on the terrain's material (not on decal_mat of course). Once I do this the decals are always created with the terrain's shader settings applied (it even uses their mtlskins) altough every decal is given the decal_mat as material at the creation. I have particle_mode at 8.
Last edited by RedPhoenix; 08/12/08 20:00.
|
|
|
Re: ent_decal and particle material V7.10
[Re: jcl]
#224075
08/28/08 12:08
08/28/08 12:08
|
Joined: Aug 2001
Posts: 2,320 Alberta, Canada
William
Expert
|
Expert
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
|
Huh, that's an effect. It's just setting those shaders to the material.
MATERIAL* road_shader = {}
function shader_static() { my.material = static_shader;
if(lightmap_level == 1){static_shader.effect = "multitex4_ps1_0sha.fx";} if(lightmap_level != 1){static_shader.effect = "detail_staticmesh.fx";}
static_shader.ambient_red = static_ambient.x; static_shader.ambient_blue = static_ambient.y; static_shader.ambient_green = static_ambient.z;
static_shader.diffuse_red = static_diffuse.x; static_shader.diffuse_blue =static_diffuse.y; static_shader.diffuse_green = static_diffuse.z; }
This works the same as effect_load(), with the difference of it being more flexible. Although, I don't see what this has to do with the decal material not working properly, and this code is just for the ground anyways.
Here is the decal code:
vec_set(trace_height.x,vector(0,0,0)); vec_add(trace_height.x,my.x); //initial trace detects for walls/terrain //target = 0; vec_set(temp_vec, you.x); temp_vec.z -= 4000; trace_height.z += 20;// effect_local(exhuast2, 12*time_step+1, trace_height.x, nullvector);
vec_set(temp_vec.x,vector(0,0,-35000)); vec_add(temp_vec.x,my.x); //initial trace detects for walls/terrain
result = c_trace(trace_height.x, temp_vec.x, IGNORE_ME+IGNORE_SPRITES+IGNORE_PASSABLE+USE_POLYGON+IGNORE_PASSENTS+ SCAN_TEXTURE); //result -= 20;
if(you != NULL) { PARTICLE *par; par = ent_decal(you, d_shadow, 0, my.pan - you.pan);
par.material = mat_model; set(par, TRANSLUCENT); par.alpha = 70; par.lifespan = 0.001; }
|
|
|
|