void Party::loadFile(const char* filename) { FILE *f = fopen(filename, "r"); if(!f){ printf("File could not be loaded"); return; } fscanf(f, "%d", &size); int colourNr; fscanf(f, "%d", &colourNr); for(int i = 0; i < colourNr; ++i){ colours.push_back(i); check.push_back(false); } createMatrices(); for(int i = 0; i < size; ++i){ for(int j = 0; j < size; ++j){ fscanf(f, "%d", ¤tWeek[i][j]); //printf("%d", currentWeek[i][j]); } } fclose(f); }
void Model::processMatrices() { Matrices mat = createMatrices(); m_matricesSSBO.create(sizeof(Matrices), GL_SHADER_STORAGE_BUFFER, GL_STATIC_DRAW); glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(Matrices), &mat); m_matricesSSBO.setBindingPoint(1); }
void Model::updateMatrices() { Matrices mat = createMatrices(); m_matricesSSBO.bind(); m_matricesSSBO.mapBuffer(&mat, sizeof(Matrices)); m_camera.setUpdate(false); }
static void convertToPamPnm(struct pam * const outpamP, jas_image_t * const jasperP, int const jasperCmptNo[]) { jas_matrix_t ** matrix; /* malloc'ed */ /* matrix[X] is the data for Plane X of the current row */ sample * jasperMaxval; unsigned int row; tuple * tuplerow; jas_seqent_t ** jasperRow; /* malloc'ed */ /* A row of a plane of the raster from the Jasper library This is an array of pointers into the 'matrix' data structures. */ bool singleMaxval; createMatrices(outpamP, &matrix); computeComponentMaxval(outpamP, jasperP, jasperCmptNo, &jasperMaxval, &singleMaxval); MALLOCARRAY(jasperRow, outpamP->depth); if (jasperRow == NULL) pm_error("Out of memory"); tuplerow = pnm_allocpamrow(outpamP); for (row = 0; row < outpamP->height; ++row) { unsigned int plane; for (plane = 0; plane < outpamP->depth; ++plane) { int rc; rc = jas_image_readcmpt(jasperP, jasperCmptNo[plane], 0, row, outpamP->width, 1, matrix[plane]); if (rc != 0) pm_error("jas_image_readcmpt() of row %u plane %u " "failed.", row, plane); jasperRow[plane] = jas_matrix_getref(matrix[plane], 0, 0); } if (singleMaxval) copyRowSingleMaxval(jasperRow, tuplerow, outpamP); else copyRowAnyMaxval(jasperRow, tuplerow, outpamP, jasperMaxval); pnm_writepamrow(outpamP, tuplerow); } pnm_freepamrow(tuplerow); destroyMatrices(outpamP, matrix); free(jasperRow); free(jasperMaxval); }