projects
/
convexer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WVT alpha
[convexer.git]
/
cxr
/
cxr.h
diff --git
a/cxr/cxr.h
b/cxr/cxr.h
index 0585f1a240bcc66165bb3a1081844734eab2a04a..e1c1679f405ff2fda3080bcc67ea304acc20b0b7 100644
(file)
--- a/
cxr/cxr.h
+++ b/
cxr/cxr.h
@@
-159,6
+159,7
@@
struct cxr_static_mesh
i32 index,
edge_index;
v2f uv;
i32 index,
edge_index;
v2f uv;
+ double alpha;
}
*loops;
}
*loops;
@@
-192,6
+193,7
@@
struct cxr_loop
edge_index,
index;
v2f uv;
edge_index,
index;
v2f uv;
+ float alpha;
};
struct cxr_solid
};
struct cxr_solid
@@
-514,9
+516,12
@@
CXR_API void cxr_write_test_data( cxr_static_mesh *src )
fprintf( fp, "cxr_static_loop test_loops[] = {\n" );
for( int i=0; i<src->loop_count; i ++ )
{
fprintf( fp, "cxr_static_loop test_loops[] = {\n" );
for( int i=0; i<src->loop_count; i ++ )
{
- fprintf( fp, " {%d, %d},\n",
+ fprintf( fp, " {%d, %d
, {%f, %f}, %f
},\n",
src->loops[i].index,
src->loops[i].index,
- src->loops[i].edge_index);
+ src->loops[i].edge_index,
+ src->loops[i].uv[0],
+ src->loops[i].uv[1],
+ src->loops[i].alpha );
}
fprintf( fp, "};\n" );
}
fprintf( fp, "};\n" );
@@
-2084,6
+2089,7
@@
static cxr_mesh *cxr_to_internal_format(
lp->index = src->loops[i].index;
lp->edge_index = src->loops[i].edge_index;
v2_copy( src->loops[i].uv, lp->uv );
lp->index = src->loops[i].index;
lp->edge_index = src->loops[i].edge_index;
v2_copy( src->loops[i].uv, lp->uv );
+ lp->alpha = src->loops[i].alpha;
}
abverts->count = src->vertex_count;
}
abverts->count = src->vertex_count;
@@
-2777,6
+2783,13
@@
static int cxr_write_disp( cxr_mesh *mesh, cxr_world *world,
}
}
}
}
+ /* Collect alphas from loops. This discards hard blend information */
+ for( int i=0; i<mesh->abloops.count; i++ )
+ {
+ cxr_loop *loop = &mesh->loops[i];
+ vertinfo[loop->index].alpha = loop->alpha * 255.0;
+ }
+
v3f refv, refu, refn;
v3_zero(refv); v3_zero(refu); v3_zero(refn);
v3f refv, refu, refn;
v3_zero(refv); v3_zero(refu); v3_zero(refn);
@@
-3145,6
+3158,7
@@
static int cxr_write_disp( cxr_mesh *mesh, cxr_world *world,
v3f normals[25];
double distances[25];
v3f normals[25];
double distances[25];
+ double alphas[25];
v3f lside0, lside1, lref, vdelta, vworld;
double tx, ty;
v3f lside0, lside1, lref, vdelta, vworld;
double tx, ty;
@@
-3169,6
+3183,8
@@
static int cxr_write_disp( cxr_mesh *mesh, cxr_world *world,
v3_copy( vdelta, normals[index] );
v3_normalize( normals[index] );
distances[index] = v3_dot( vdelta, normals[index] );
v3_copy( vdelta, normals[index] );
v3_normalize( normals[index] );
distances[index] = v3_dot( vdelta, normals[index] );
+
+ alphas[index] = vertinfo[grid[index]].alpha;
}
}
}
}
@@
-3215,6
+3231,11
@@
static int cxr_write_disp( cxr_mesh *mesh, cxr_world *world,
cxr_vdf_karrdouble( output, "row", k, &distances[k*5], 5 );
cxr_vdf_edon( output );
cxr_vdf_karrdouble( output, "row", k, &distances[k*5], 5 );
cxr_vdf_edon( output );
+ cxr_vdf_node( output, "alphas" );
+ for( int k=0; k<5; k++ )
+ cxr_vdf_karrdouble( output, "row", k, &alphas[k*5], 5 );
+ cxr_vdf_edon( output );
+
/*
* TODO: This might be needed for the compilers. Opens fine in
* hammer
/*
* TODO: This might be needed for the compilers. Opens fine in
* hammer
@@
-3233,11
+3254,6
@@
static int cxr_write_disp( cxr_mesh *mesh, cxr_world *world,
"\"row%d\" \"0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\"\n", k );
cxr_vdf_edon( output );
"\"row%d\" \"0 0 1 0 0 1 0 0 1 0 0 1 0 0 1\"\n", k );
cxr_vdf_edon( output );
- cxr_vdf_node( output, "alphas" );
- for( int k=0; k<5; k++ )
- cxr_vdf_printf( output, "\"row%d\" \"0 0 0 0 0\"\n", k );
- cxr_vdf_edon( output );
-
cxr_vdf_node( output, "triangle_tags" );
for( int k=0; k<5-1; k++ )
cxr_vdf_printf( output,
cxr_vdf_node( output, "triangle_tags" );
for( int k=0; k<5-1; k++ )
cxr_vdf_printf( output,