(other)
| 163 | } |
| 164 | |
| 165 | pad(other) { |
| 166 | this.array = mapValues(this.array, (array: [], name: string) => { |
| 167 | const new_array = new (array.constructor as any)(other.length); |
| 168 | if (typeof other.array[name] === "undefined") { // then other must be a scalar |
| 169 | new_array.fill(other.scalar[name], this.length); |
| 170 | } else { |
| 171 | new_array.set(other.array[name].slice(this.length), this.length); |
| 172 | } |
| 173 | new_array.set(array); |
| 174 | return new_array; |
| 175 | }); |
| 176 | this.array_vec3 = mapValues(this.array_vec3, (array_vec3: [], name: string) => { |
| 177 | const new_array = new (array_vec3.constructor as any)(other.length * 3); |
| 178 | if (typeof other.array_vec3[name] === "undefined") { // then other must be a scalar |
| 179 | const other_scalar = other.scalar_vec3[name]; |
| 180 | for (let i = this.length; i < other.length; i++) { |
| 181 | new_array[i * 3 + 0] = other_scalar[0]; |
| 182 | new_array[i * 3 + 1] = other_scalar[1]; |
| 183 | new_array[i * 3 + 2] = other_scalar[2]; |
| 184 | } |
| 185 | } else { |
| 186 | new_array.set(other.array_vec3[name].slice(this.length * 3), this.length * 3); |
| 187 | } |
| 188 | new_array.set(array_vec3); |
| 189 | return new_array; |
| 190 | }); |
| 191 | this.array_vec4 = mapValues(this.array_vec4, (array_vec4: [], name) => { |
| 192 | const new_array = new (array_vec4.constructor as any)(other.length * 4); |
| 193 | if (typeof other.array_vec4[name] === "undefined") { |
| 194 | // then other must be a scalar |
| 195 | const other_scalar = other.scalar_vec4[name]; |
| 196 | for (let i = this.length; i < other.length; i++) { |
| 197 | new_array[i * 4 + 0] = other_scalar[0]; |
| 198 | new_array[i * 4 + 1] = other_scalar[1]; |
| 199 | new_array[i * 4 + 2] = other_scalar[2]; |
| 200 | new_array[i * 4 + 3] = other_scalar[3]; |
| 201 | } |
| 202 | } else { |
| 203 | new_array.set(other.array_vec4[name].slice(this.length * 4), this.length * 4); |
| 204 | } |
| 205 | new_array.set(array_vec4); |
| 206 | return new_array; |
| 207 | }); |
| 208 | this.length = other.length; |
| 209 | } |
| 210 | |
| 211 | select(selected) { |
| 212 | // copy since we will modify |
no test coverage detected