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) {
Indicates which channel the texture in this LwoSurfaceBlock is applied to.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
For cylindrical and spherical projections, this parameter controls how many times the image repeats o...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A texture layer or shader, part of a LwoSurface chunk.
The tMap chunk within a LwoSurfaceBlock chunk.
Specifies how the texture image appears for areas outside the image.
Specifies the name of a set of UV's defined on the polygons that use this model.
The basic kind of record in an EA "IFF" file, which the LightWave object file is based on.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Indicates the projection mode for this particular shader.
Indicates the axis for this particular shader's projection.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class supervises the construction of an EggData structure from the data represented by the LwoHe...
Indicates whether this particular layer or shader should be rendered or not.
Specifies the particular image that is being applied as a texture.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is a wrapper around LwoSurfaceBlockTMap and stores additional information useful during th...
A four-byte chunk ID appearing in an "IFF" file.
IffId get_id() const
Returns the ID associated with this chunk.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.