File: NopRenderView.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 (74 lines) | stat: -rw-r--r-- 2,154 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once

#include "irenderview.h"
#include "NopVolumeTest.h"
#include "math/Frustum.h"
#include "math/Viewer.h"

namespace render
{

class NopRenderView :
    public IRenderView
{
private:
    NopVolumeTest _volumeTest;
    Frustum _frustum;
    Viewer _viewer;

public:
    bool TestPoint(const Vector3& point) const { return _volumeTest.TestPoint(point); }
    bool TestLine(const Segment& segment) const { return _volumeTest.TestLine(segment); }
    bool TestPlane(const Plane3& plane) const { return _volumeTest.TestPlane(plane); }
    bool TestPlane(const Plane3& plane, const Matrix4& localToWorld) const { return _volumeTest.TestPlane(plane, localToWorld); }

    VolumeIntersectionValue TestAABB(const AABB& aabb) const
    {
        return _volumeTest.TestAABB(aabb);
    }

    VolumeIntersectionValue TestAABB(const AABB& aabb, const Matrix4& localToWorld) const
    { 
        return _volumeTest.TestAABB(aabb, localToWorld);
    }

    bool fill() const { return _volumeTest.fill(); }

    const Matrix4& GetViewProjection() const { return _volumeTest.GetViewProjection(); }
    const Matrix4& GetViewport() const { return _volumeTest.GetViewport(); }
    const Matrix4& GetProjection() const { return _volumeTest.GetProjection(); }
    const Matrix4& GetModelview() const { return _volumeTest.GetModelview(); }

    void construct(const Matrix4& projection, const Matrix4& modelview, std::size_t width, std::size_t height) override
    {
        _volumeTest.setProjection(projection);
        _volumeTest.setModelView(modelview);

        _volumeTest.setViewProjection(projection.getMultipliedBy(modelview));

        _frustum = Frustum::createFromViewproj(_volumeTest.GetViewProjection());
        _viewer = Viewer::createFromViewProjection(_volumeTest.GetViewProjection());
    }

    Vector3 getViewer() const override
    {
        return _viewer.getVector3();
    }

    void setViewer(const Vector3& viewer)
    {
        _viewer = Vector4(viewer, 1.0);
    }

    const Frustum& getFrustum() const override
    {
        return _frustum;
    }

    std::string getCullStats() const override
    {
        return {};
    }
};

}