|
Re: supertrace plugin / second uv-set plugin
[Re: fogman]
#134241
06/09/07 14:14
06/09/07 14:14
|
Joined: Jun 2003
Posts: 1,017 Germany
Thomas_Nitschke
Senior Developer
|
Senior Developer
Joined: Jun 2003
Posts: 1,017
Germany
|
It seems I cannot rate you higher than this. Damn the forum software Congratulations ventilator, this is really one of the greatest contributions ever seen around here.
Formerly known as The Matrix - ICQ 170408644
I've been here for much longer than most people think. So where's my "Expert" status?
|
|
|
Re: supertrace plugin / second uv-set plugin
[Re: ventilator]
#134243
06/10/07 06:46
06/10/07 06:46
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
So this is all generated from WED? And it supports static lights? And can be generated from WED? If this is all true, then you are truly the master. If not, your still the master, lol. That is, until I catch up with you
xXxGuitar511 - Programmer
|
|
|
Re: supertrace plugin / second uv-set plugin
[Re: William]
#134247
06/16/07 12:20
06/16/07 12:20
|
Joined: Nov 2004
Posts: 862 Australia
DavidLancaster
User
|
User
Joined: Nov 2004
Posts: 862
Australia
|
Hey Ventilator I can get your script to work, but when I tried implementing it myself I got an error 'crash in bmap_getcolor'. Any ideas? Thank you! Code:
plugindir = ".";
////////////////////////////// // supertrace ////////////////////////////// dllfunction drawuvs(entity, &positionandscale, &color, alpha); // slow! dllfunction tc_beginbuild(); dllfunction tc_addentity(entity); dllfunction tc_endbuild(); dllfunction supertrace(&p0, &p1); dllfunction bmap_getcolor(bitmap, &recolor, xx, yy); // much faster than pixel_for_bmap() (doesn't work with dds!) var trace_uv1[3]; var trace_uv2[3];
////////////////////////////// // mesh lightmapping //////////////////////////////
dllfunction ent_loadseconduvset(entity1, entity2); dllfunction ent_exportmesh(entity, filename); dllfunction ent_importmesh(entity, filename);
material* tempmaterial;
bmap bmap_lightmap = "pingvillage_lm.tga";
material mtl_lightmap { skin1 = bmap_lightmap; effect= " texture mtlSkin1; texture entSkin1;
technique t0 { pass p0 { Texture[0]=<mtlSkin1>; Texture[1]=<entSkin1>; // mix light map with dynamic lighting TexCoordIndex[0] = 1; ColorArg1[0] = Texture; ColorOp[0] = AddSigned; ColorArg2[0] = Diffuse; // apply lighting to texture TexCoordIndex[1] = 0; ColorArg1[1] = Texture; ColorOp[1] = Modulate2x; ColorArg2[1] = Current; } } "; }
var color[3]; ACTION lightmapped_mesh { my.scale_z *= 1.12; my.nofog = on; my.polygon = on; my.unlit = on; my.ambient = 80;
my.material = mtl_lightmap; // assign light map material ent_importmesh(my, "pingvillage_lm.mesh"); // load and assign the previously saved mesh which contains both uv-sets
/* temp_ent = ent_create("pingvillage_lm.mdl", nullvector, 0); // load model with light map uv-set ent_loadseconduvset(my,temp_ent); // generate and assign a new mesh with both uv-sets ent_remove(temp_ent); // tempentity isn't needed anymore ent_exportmesh(my,"pingvillage_lm.mesh"); // save mesh with both uv-sets for reuse */
tc_beginbuild(); tc_addentity(my); tc_endbuild();
WHILE (1) { WHILE (!player) { wait(1); } temp_ent = ptr_for_handle(player.animated_attach); you = supertrace(vector(player.x,player.y,player.z),vector(player.x,player.y,player.z - 4000)); // you = supertrace(vector(camera.x, camera.y, camera.z), vector(camera.x, camera.y, -10000)); if (you) { bmap_getcolor(bmap_lightmap, color, trace_uv2.x * 1024, trace_uv2.y * 1024); temp_ent.light = on; temp_ent.blue = color.blue; temp_ent.green = color.green; temp_ent.red = color.red; } wait(1); } }
|
|
|
|