mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
texmat
This commit is contained in:
parent
19e0b0824c
commit
5c7be58565
@ -981,6 +981,8 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
|
||||
// We only support single-texturing, so only bother with the first
|
||||
// texture stage.
|
||||
bool needs_texcoord = false;
|
||||
bool needs_texmat = false;
|
||||
LMatrix4f texmat;
|
||||
const InternalName *texcoord_name = InternalName::get_texcoord();
|
||||
int max_stage_index = _effective_texture->get_num_on_ff_stages();
|
||||
if (max_stage_index > 0) {
|
||||
@ -988,6 +990,11 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
|
||||
rtexcoord = GeomVertexReader(data_reader, stage->get_texcoord_name());
|
||||
rtexcoord.set_row(_min_vertex);
|
||||
needs_texcoord = rtexcoord.has_column();
|
||||
|
||||
if (needs_texcoord && _target._tex_matrix->has_stage(stage)) {
|
||||
needs_texmat = true;
|
||||
texmat = _target._tex_matrix->get_mat(stage);
|
||||
}
|
||||
}
|
||||
|
||||
bool needs_color = false;
|
||||
@ -1047,7 +1054,14 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader,
|
||||
v->coord.Z = d[2];
|
||||
v->coord.W = d[3];
|
||||
|
||||
if (needs_texcoord) {
|
||||
if (needs_texmat) {
|
||||
// Transform texcoords as a four-component vector for most generality.
|
||||
LVecBase4f d = rtexcoord.get_data4f() * texmat;
|
||||
v->tex_coord.X = d[0];
|
||||
v->tex_coord.Y = d[1];
|
||||
|
||||
} else if (needs_texcoord) {
|
||||
// No need to transform, so just extract as two-component.
|
||||
const LVecBase2f &d = rtexcoord.get_data2f();
|
||||
v->tex_coord.X = d[0];
|
||||
v->tex_coord.Y = d[1];
|
||||
|
@ -82,7 +82,7 @@ void FNAME(ZB_fillTriangleMapping) (ZBuffer *zb,
|
||||
{ \
|
||||
zz=z >> ZB_POINT_Z_FRAC_BITS; \
|
||||
if (ZCMP(pz[_a], zz)) { \
|
||||
tmp=texture[((t & 0x3FC00000) | s) >> 14]; \
|
||||
tmp=texture[((t & 0x3FC00000) | (s & 0x3fc000)) >> 14]; \
|
||||
if (ACMP(zb, PIXEL_A(tmp))) { \
|
||||
STORE_PIX(pp[_a], tmp, PIXEL_R(tmp), PIXEL_G(tmp), PIXEL_B(tmp), PIXEL_A(tmp)); \
|
||||
STORE_Z(pz[_a], zz); \
|
||||
@ -118,7 +118,7 @@ void FNAME(ZB_fillTriangleMappingFlat) (ZBuffer *zb,
|
||||
{ \
|
||||
zz=z >> ZB_POINT_Z_FRAC_BITS; \
|
||||
if (ZCMP(pz[_a], zz)) { \
|
||||
tmp=texture[((t & 0x3FC00000) | s) >> 14]; \
|
||||
tmp=texture[((t & 0x3FC00000) | (s & 0x3fc000)) >> 14]; \
|
||||
int a = oa * PIXEL_A(tmp) >> 16; \
|
||||
if (ACMP(zb, a)) { \
|
||||
STORE_PIX(pp[_a], \
|
||||
@ -159,7 +159,7 @@ void FNAME(ZB_fillTriangleMappingSmooth) (ZBuffer *zb,
|
||||
{ \
|
||||
zz=z >> ZB_POINT_Z_FRAC_BITS; \
|
||||
if (ZCMP(pz[_a], zz)) { \
|
||||
tmp=texture[((t & 0x3FC00000) | s) >> 14]; \
|
||||
tmp=texture[((t & 0x3FC00000) | (s & 0x3fc000)) >> 14]; \
|
||||
int a = oa1 * PIXEL_A(tmp) >> 16; \
|
||||
if (ACMP(zb, a)) { \
|
||||
STORE_PIX(pp[_a], \
|
||||
|
Loading…
x
Reference in New Issue
Block a user