File: RenderableColouredBoundingBoxes.h

package info (click to toggle)
darkradiant 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,080 kB
  • sloc: cpp: 264,743; ansic: 10,659; python: 1,852; xml: 1,650; sh: 92; makefile: 21
file content (28 lines) | stat: -rw-r--r-- 653 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include "RenderableBoundingBoxes.h"

namespace render
{

// Specialised bounding box renderer supporting invididual box colours
class RenderableColouredBoundingBoxes :
    public RenderableBoundingBoxes
{
private:
    const std::vector<Vector4>& _colours;

public:
    RenderableColouredBoundingBoxes(const std::vector<AABB>& aabbs, const std::vector<Vector4>& colours) :
        RenderableBoundingBoxes(aabbs, { 1,1,1,1 }),
        _colours(colours)
    {}

protected:
    virtual Vector4 getBoxColour(std::size_t boxIndex) override
    {
        return _colours.size() > boxIndex ? _colours[boxIndex] : Vector4(1, 1, 1, 1);
    }
};

}