31 _converter(converter),
34 _block_type = _block->_header->get_id();
35 _ordinal = _block->_header->_ordinal;
37 _opacity_type = LwoSurfaceBlockOpacity::T_additive;
39 _transform = LMatrix4d::ident_mat();
40 _inv_transform = LMatrix4d::ident_mat();
41 _projection_mode = LwoSurfaceBlockProjection::M_uv;
42 _axis = LwoSurfaceBlockAxis::A_y;
44 _w_wrap = LwoSurfaceBlockWrap::M_repeat;
45 _h_wrap = LwoSurfaceBlockWrap::M_repeat;
51 int num_hchunks = _block->_header->get_num_chunks();
52 for (
int hi = 0; hi < num_hchunks; hi++) {
53 const IffChunk *hchunk = _block->_header->get_chunk(hi);
55 if (hchunk->
is_of_type(LwoSurfaceBlockChannel::get_class_type())) {
58 _channel_id = bc->_channel_id;
60 }
else if (hchunk->
is_of_type(LwoSurfaceBlockEnabled::get_class_type())) {
63 _enabled = ec->_enabled;
68 int num_chunks = _block->get_num_chunks();
69 for (
int i = 0; i < num_chunks; i++) {
70 const IffChunk *chunk = _block->get_chunk(i);
72 if (chunk->
is_of_type(LwoSurfaceBlockTMap::get_class_type())) {
74 if (_tmap !=
nullptr) {
75 nout <<
"Two TMAP chunks encountered within surface block.\n";
80 }
else if (chunk->
is_of_type(LwoSurfaceBlockProjection::get_class_type())) {
82 _projection_mode = proj->_mode;
84 }
else if (chunk->
is_of_type(LwoSurfaceBlockAxis::get_class_type())) {
88 }
else if (chunk->
is_of_type(LwoSurfaceBlockImage::get_class_type())) {
90 _clip_index = image->_index;
92 }
else if (chunk->
is_of_type(LwoSurfaceBlockWrap::get_class_type())) {
94 _w_wrap = wrap->_width;
95 _h_wrap = wrap->_height;
97 }
else if (chunk->
is_of_type(LwoSurfaceBlockWrap::get_class_type())) {
99 _w_wrap = wrap->_width;
100 _h_wrap = wrap->_height;
102 }
else if (chunk->
is_of_type(LwoSurfaceBlockVMapName::get_class_type())) {
104 _uv_name = vmap->_name;
106 }
else if (chunk->
is_of_type(LwoSurfaceBlockRepeat::get_class_type())) {
109 _w_repeat = repeat->_cycles;
111 _h_repeat = repeat->_cycles;
116 if (_tmap !=
nullptr) {
117 _tmap->get_transform(_transform);
123 case LwoSurfaceBlockAxis::A_x:
124 _transform = LMatrix4d::rotate_mat(90.0,
125 LVecBase3d::unit_z(),
126 CS_yup_left) * _transform;
129 case LwoSurfaceBlockAxis::A_y:
132 case LwoSurfaceBlockAxis::A_z:
133 _transform = LMatrix4d::rotate_mat(-90.0,
134 LVecBase3d::unit_x(),
135 CS_yup_left) * _transform;
139 _inv_transform.invert_from(_transform);
146 ~CLwoSurfaceBlock() {
147 if (_tmap !=
nullptr) {