MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / renderGraph

Method renderGraph

shared/Graph.h:23–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 }
22
23 void renderGraph(VulkanCanvas& c, const glm::vec4& color = vec4(1.0)) const
24 {
25 EASY_FUNCTION();
26
27 float minfps = std::numeric_limits<float>::max();
28 float maxfps = std::numeric_limits<float>::min();
29
30 for (float f : graph_)
31 {
32 if (f < minfps) minfps = f;
33 if (f > maxfps) maxfps = f;
34 }
35
36 const float range = maxfps - minfps;
37
38 float x = 0.0;
39 vec3 p1 = vec3(0, 0, 0);
40
41 for (float f : graph_)
42 {
43 const float val = (f - minfps) / range;
44 const vec3 p2 = vec3(x, val * 0.15f, 0);
45 x += 1.0f / maxPoints_;
46 c.line(p1, p2, color);
47 p1 = p2;
48 }
49 }
50
51private:
52 std::deque<float> graph_;

Callers 1

update2DFunction · 0.80

Calls 1

lineMethod · 0.45

Tested by

no test coverage detected