| 129 | } |
| 130 | |
| 131 | void xDecalEmitter::emit(const xMat4x3& mat, S32 texture_index) |
| 132 | { |
| 133 | if (this->units.full()) |
| 134 | { |
| 135 | this->units.pop_back(); |
| 136 | } |
| 137 | |
| 138 | this->units.push_front(); |
| 139 | unit_data& udata = this->units.front(); |
| 140 | udata.age = 0.0f; |
| 141 | |
| 142 | if (this->cfg.flags & 0x2) |
| 143 | { |
| 144 | udata.mat.right.assign(1.0f, 1.0f, 1.0f); |
| 145 | udata.mat.pos = mat.pos; |
| 146 | udata.cull_size = 0.5f; |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | udata.mat = mat; |
| 151 | F32 greatest_length = choose_greatest(udata.mat.right.length(), udata.mat.up.length(), udata.mat.at.length()); |
| 152 | udata.cull_size = greatest_length * 0.5f; |
| 153 | } |
| 154 | |
| 155 | if (texture_index < 0 || texture_index > (S32)this->texture.units) |
| 156 | { |
| 157 | texture_index = this->select_texture_unit(); |
| 158 | } |
| 159 | |
| 160 | udata.u = texture_index % this->cfg.texture.rows; |
| 161 | udata.v = texture_index / this->cfg.texture.rows; |
| 162 | } |
| 163 | |
| 164 | namespace |
| 165 | { |
no test coverage detected