15 #include "cLwoSurfaceBlock.h"
16 #include "cLwoSurfaceBlockTMap.h"
17 #include "lwoToEggConverter.h"
19 #include "lwoSurfaceBlockChannel.h"
20 #include "lwoSurfaceBlockEnabled.h"
21 #include "lwoSurfaceBlockImage.h"
22 #include "lwoSurfaceBlockRepeat.h"
23 #include "lwoSurfaceBlockVMapName.h"
34 _converter(converter),
37 _block_type = _block->_header->get_id();
38 _ordinal = _block->_header->_ordinal;
40 _opacity_type = LwoSurfaceBlockOpacity::T_additive;
44 _projection_mode = LwoSurfaceBlockProjection::M_uv;
45 _axis = LwoSurfaceBlockAxis::A_y;
47 _w_wrap = LwoSurfaceBlockWrap::M_repeat;
48 _h_wrap = LwoSurfaceBlockWrap::M_repeat;
54 int num_hchunks = _block->_header->get_num_chunks();
55 for (
int hi = 0; hi < num_hchunks; hi++) {
56 const IffChunk *hchunk = _block->_header->get_chunk(hi);
58 if (hchunk->
is_of_type(LwoSurfaceBlockChannel::get_class_type())) {
61 _channel_id = bc->_channel_id;
63 }
else if (hchunk->
is_of_type(LwoSurfaceBlockEnabled::get_class_type())) {
66 _enabled = ec->_enabled;
71 int num_chunks = _block->get_num_chunks();
72 for (
int i = 0; i < num_chunks; i++) {
73 const IffChunk *chunk = _block->get_chunk(i);
75 if (chunk->
is_of_type(LwoSurfaceBlockTMap::get_class_type())) {
78 nout <<
"Two TMAP chunks encountered within surface block.\n";
83 }
else if (chunk->
is_of_type(LwoSurfaceBlockProjection::get_class_type())) {
85 _projection_mode = proj->_mode;
87 }
else if (chunk->
is_of_type(LwoSurfaceBlockAxis::get_class_type())) {
91 }
else if (chunk->
is_of_type(LwoSurfaceBlockImage::get_class_type())) {
93 _clip_index = image->_index;
95 }
else if (chunk->
is_of_type(LwoSurfaceBlockWrap::get_class_type())) {
97 _w_wrap = wrap->_width;
98 _h_wrap = wrap->_height;
100 }
else if (chunk->
is_of_type(LwoSurfaceBlockWrap::get_class_type())) {
102 _w_wrap = wrap->_width;
103 _h_wrap = wrap->_height;
105 }
else if (chunk->
is_of_type(LwoSurfaceBlockVMapName::get_class_type())) {
107 _uv_name = vmap->_name;
109 }
else if (chunk->
is_of_type(LwoSurfaceBlockRepeat::get_class_type())) {
112 _w_repeat = repeat->_cycles;
114 _h_repeat = repeat->_cycles;
120 _tmap->get_transform(_transform);
127 case LwoSurfaceBlockAxis::A_x:
130 CS_yup_left) * _transform;
133 case LwoSurfaceBlockAxis::A_y:
136 case LwoSurfaceBlockAxis::A_z:
139 CS_yup_left) * _transform;
143 _inv_transform.invert_from(_transform);
152 ~CLwoSurfaceBlock() {
Indicates which channel the texture in this LwoSurfaceBlock is applied to.
static LMatrix4d rotate_mat(double angle, const LVecBase3d &axis, CoordinateSystem cs=CS_default)
Returns a matrix that rotates by the given angle in degrees counterclockwise about the indicated vect...
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
For cylindrical and spherical projections, this parameter controls how many times the image repeats o...
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...
static const LMatrix4d & ident_mat()
Returns an identity matrix.
static const LVecBase3d & unit_z()
Returns a unit Z vector.
IffId get_id() const
Returns the ID associated with this chunk.
Indicates the projection mode for this particular shader.
Indicates the axis for this particular shader's projection.
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.
static const LVecBase3d & unit_x()
Returns a unit X vector.
Specifies the particular image that is being applied as a texture.
This class is a wrapper around LwoSurfaceBlockTMap and stores additional information useful during th...
A four-byte chunk ID appearing in an "IFF" file.