fixed problem with matrix combination

This commit is contained in:
leca 2025-02-28 23:12:05 +03:00
parent a55efdab95
commit a6f9581a70
1 changed files with 10 additions and 11 deletions

View File

@ -113,7 +113,7 @@ void CoilSegment::constructSegment(double *slice) {
for (uint32_t day = 0; day < DAYS_IN_YEAR; day ++) {
float daysDegree = day * degreesPerDay;
// TODO: replace 10 to coil->getWidth();
// TODO: replace hardcoded value to coil->getWidth();
vec3 daysPosition = vec3(
cos(radians(daysDegree)) * 200,
10* daysDegree/360.,
@ -121,12 +121,11 @@ void CoilSegment::constructSegment(double *slice) {
);
mat4 transform = mat4(1.);
// For some reason I cannot combine transform and rotation to one singe matrix.
// TODO: investigate and fix
// transform = translate(
// transform,
// daysPosition
// );
transform = translate(
transform,
daysPosition
);
transform = rotate(
transform,
@ -147,11 +146,11 @@ void CoilSegment::constructSegment(double *slice) {
1
);
point = point*transform ;
point = transform * point;
uint64_t currentPointOffset = day * (2+sliceDetalization) * FIELDS_IN_POINT + slicePointOffset;
vertices[currentPointOffset + 0] = point.x + daysPosition.x;
vertices[currentPointOffset + 1] = point.y + daysPosition.y;
vertices[currentPointOffset + 2] = point.z + daysPosition.z;
vertices[currentPointOffset + 0] = point.x;
vertices[currentPointOffset + 1] = point.y;
vertices[currentPointOffset + 2] = point.z;
memcpy(
vertices + currentPointOffset + 3,