void RenderContext::prime(std::function<void(HotRenderContext&)> func) { // check if another target is already current if(s_primedContext) { logThrowGL("[RenderContext] You cannot prime more than one RenderContext " "at a time!"); } if(s_creationLock) { logThrowGL("[RenderContext] You cannot prime a RenderContext while another " "is being create!"); } if(!m_wasCreated) { logThrowGL("[RenderContext] You cannot prime a RenderContext that was not " "created yet!"); } // make context current and create HotContext makeCurrent(); HotRenderContext hot(*this); s_primedContext = &hot; // call function func(hot); // reset state resetCurrent(); s_primedContext = nullptr; }
void Program::prime(std::function<void(HotProgram&)> func) { if(m_handle == 0) { logThrowGL("[Program] Attempt to prime program before it was created!"); } HotProgram hot(*this); func(hot); }
/* pastel shades of pink color map */ static void pink (double x, double *r, double *g, double *b) { hot(x, r, g, b); *r = sqrt((2*x+*r)/3); *g = sqrt((2*x+*g)/3); *b = sqrt((2*x+*b)/3); return; } /* end pink() */
int main() { int cases; scanf("%d", &cases); while(cases--) hot(); }
/* gray-scale with a tinge of blue color map */ static void bone (double x, double *r, double *g, double *b) { double rh,gh,bh; hot(x, &rh, &gh, &bh); *r = (7*x + bh)/8; *g = (7*x + gh)/8; *b = (7*x + rh)/8; return; } /* end bone() */
/*----------------------------------------------------------------------------*/ void save_xbm( const claw::graphic::image& img, const std::string& filename ) { claw::math::coordinate_2d<int> hot(10, 10); std::cout << "no hot" << std::endl; save_xbm( img, filename, "cold", NULL ); std::cout << "hot" << std::endl; save_xbm( img, filename, "hot", &hot ); }
void ElasticAnalogy(GModel *m, bool onlyVisible) { bool CAD, complete; int meshOrder; getMeshInfoForHighOrder(m, meshOrder, complete, CAD); highOrderTools hot(m); // now we smooth mesh the internal vertices of the faces // we do that model face by model face std::vector<MElement*> bad; double worst; checkHighOrderTriangles("Surface mesh", m, bad, worst); { for(GModel::fiter it = m->firstFace(); it != m->lastFace(); ++it) { if (onlyVisible && !(*it)->getVisibility()) continue; std::vector<MElement*> v; v.insert(v.begin(), (*it)->triangles.begin(), (*it)->triangles.end()); v.insert(v.end(), (*it)->quadrangles.begin(), (*it)->quadrangles.end()); if (CAD) hot.applySmoothingTo(v, (*it)); else hot.applySmoothingTo(v, 1.e32, false); } } checkHighOrderTriangles("Final surface mesh", m, bad, worst); checkHighOrderTetrahedron("Volume Mesh", m, bad, worst); { for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it) { if (onlyVisible && !(*it)->getVisibility())continue; std::vector<MElement*> v; v.insert(v.begin(), (*it)->tetrahedra.begin(), (*it)->tetrahedra.end()); v.insert(v.end(), (*it)->hexahedra.begin(), (*it)->hexahedra.end()); v.insert(v.end(), (*it)->prisms.begin(), (*it)->prisms.end()); hot.applySmoothingTo(v, 1.e32, false); } } checkHighOrderTetrahedron("File volume Mesh", m, bad, worst); }