This is C++
vpID); int GetXDim(ViewPortID vpID); …struct ViewPort { ViewPort(/**/): vpID_(CreateViewPt(/**/)) {/*RAII*/} ~ViewPort(){if (vpID_) FreeViewPt(vpID_);} opera6ons?struct ViewPort { ~~~~ ViewPort(ViewPort&& vp): vpID_(vp.vpID_) {vp.vpID_ = 0;} ~~~~ };struct ViewPort { ~~~~ ViewPort(ViewPort&& vp): vpID_(vp {vp.vpID_ = 0; /* Call OS to make a new ViewPort */} ~~~~ };struct ViewPort { ~~~~ ViewPort(ViewPort&& vp): vpID_(vp.vpID_) {vp.vpID_ = 0;}0 码力 | 67 页 | 8.25 MB | 5 月前3Tracy: A Profiler You Don't Want to Miss
Instrument expensive destructors • or explicitly release smart objects at the end of a scope bool Viewport::load_scene(const char* filename) { ZoneScoped; // ... std::shared_ptrnew_scene; Instrument expensive destructors • or explicitly release smart objects at the end of a scope bool Viewport::load_scene(const char* filename) { ZoneScoped; // ... std::shared_ptr new_scene; 0 码力 | 85 页 | 6.51 MB | 5 月前33D Graphics for Dummies
0, 0, 0 }, { 0, 1, 0 }); Matrix fov = FieldOfView(45, rect.AspectRatio(), 1, 100); Matrix view = Viewport(rect, 0, 100); Screen screen = world * (pov * fov * view); screen.PerspectiveDivide(); return0 码力 | 79 页 | 4.61 MB | 5 月前3Tracy: A Profiler You Don't Want to Miss
Instrument expensive destructors • or explicitly release smart objects at the end of a scope bool Viewport::load_scene(const char* filename) { ZoneScoped; // ... std::shared_ptrnew_scene; 0 码力 | 84 页 | 8.70 MB | 5 月前3
共 4 条
- 1