Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
75
76
77
78
79
80
81
82
83
84
#include "Headers/OrbitCamera.h"

#include "Core/Headers/Application.h"
#include "Core/Math/Headers/Transform.h"
#include "Graphs/Headers/SceneGraphNode.h"
#include "Hardware/Input/Headers/InputInterface.h"

namespace Divide {

OrbitCamera::OrbitCamera(const CameraType& type, const vec3<F32>& eye) : Camera(type, eye),
                                                                         _currentRotationX(0.0),
                                                                         _currentRotationY(0.0),
                                                                         _maxRadius(10.0f),
                                                                         _minRadius(0.1f),
                                                                         _curRadius(8.0f),
                                                                         _targetNode(nullptr),
                                                                         _rotationDirty(true)
{
    setMouseSensitivity(0.5f);
}


void OrbitCamera::setTarget(SceneGraphNode* const sgn, const vec3<F32>& offsetDirection) {
    assert(sgn != nullptr);

    _targetNode = sgn;
    _offsetDir = offsetDirection;
    _offsetDir.normalize();
}

void OrbitCamera::onActivate() {
    //_cameraRotation.reset();
    Camera::onActivate();
}

void OrbitCamera::onDeactivate() {
}

bool OrbitCamera::updateViewMatrix() {
    setEye(_newEye);

    return Camera::updateViewMatrix();
}

void OrbitCamera::update(const U64 deltaTime) {
    Camera::update(deltaTime);

    if(!_targetNode) {
        return;
    }

    PhysicsComponent* const trans = _targetNode->getComponent<PhysicsComponent>();

    static vec3<F32> newTargetOrientation;

    if (/*trans->changedLastFrame() || */_rotationDirty || true) {
        trans->getOrientation().getEuler(&newTargetOrientation);
        newTargetOrientation.yaw = M_PI - newTargetOrientation.yaw;
        newTargetOrientation += _cameraRotation;
        Util::normalize(newTargetOrientation, false);
        _rotationDirty = false;
    }

    _orientation.fromEuler(newTargetOrientation, false);
    _newEye = trans->getPosition() + _orientation * (_offsetDir * _curRadius);
    _viewMatrixDirty = true;
}

bool OrbitCamera::mouseMoved(const Input::MouseEvent& arg) {
    I32 zoom = arg.state.Z.rel;
    if (zoom != 0) {
        curRadius(_curRadius += (zoom * _cameraZoomSpeed * -0.01f));
    }

    return Camera::mouseMoved(arg);
}

void OrbitCamera::move(F32 dx, F32 dy, F32 dz) {
}

void OrbitCamera::rotate(F32 yaw, F32 pitch, F32 roll) {
}

}; //namespace Divide

Commits for Divide-Framework/trunk/Source Code/Rendering/Camera/OrbitCamera.cpp

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

329 Diff Diff IonutCava picture IonutCava Tue 07 Oct, 2014 12:51:37 +0000

[Ionut]
- Modified material class and shaders to support multiple BRDFs (currently, only Flat, Phong and Blinn-Phong supported with Cook-Torrance and Oren-Nayar in future commits)
- Optimized transform updates and queries
- Fixed an indirect draw command (no buffer was bound to GL_DRAW_INDIRECT_BUFFER, violating a core requirement)

325 Diff Diff IonutCava picture IonutCava Wed 17 Sep, 2014 20:06:13 +0000

[Ionut]
- Reworked transform system:
— Parent transform chain system moved from Transform class to the PhysicsComponent
— PhysicsComponent now returns all transform values needed both global and local (still needs heavy optimization and caching)

- Reworked SceneGraph node management:
— Proper ref counting of SceneNodes and proper removing of resource (ResourceCache is now empty on destruction, as it should be)
— Removed parent transform tracking as that’s the PhysicsComponent’s responsibility
— Only nodes loaded via the ResourceCache are allowed to be added to the SceneGraph (added proper loaders for Impostors, Sky, etc)

- Optimized some of the math classes (mat4, mat3)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

309 Diff Diff IonutCava picture IonutCava Sat 16 Aug, 2014 22:57:33 +0000

[Ionut]
- Added an InputAggregator interface to standardize input event handling

308 Diff Diff IonutCava picture IonutCava Sat 16 Aug, 2014 19:49:31 +0000

[Ionut]
- Moved Transform from SceneGraphNode to PhysicsComponent and modified BoundingBox update system based on transform update
- Added PhysicsAsset to PhysicsComponent for interfacing with PshysicsAPIs (e.g. PhysXActor inherits PhysicsAsset)
- PhysicsAsset keeps track of the parent PhysicsComponent to have direct access to a node’s transform
- Rewrote GUIConsole to only print items when visible, and use a single circular buffer for entries.
- Updated GUI input system to match the interface that both Kernel and SceneManager share (should probably abstract all the input methods in a class and have Kernel, SceneManager, Scene and GUI inherit from that. In next commit.)
- Updated CEGUI to probably match the OIS states(mouse, keyboard, etc) and properly inject time inputs.

264 Diff Diff k1ngp1n picture k1ngp1n Tue 27 May, 2014 13:04:38 +0000

[Ionut] [[BR]]
- New camera system: [[BR]]
— Stack based (push/pop active camera) [[BR]]
— Per camera frustum [[BR]]
— Per camera projection [[BR]]
— Shadow mapping now uses the new camera system (each light has a shadow camera) [[BR]]
[[BR]]
- New terrain, water and vegetation system: [[BR]]
— Direct import of terrain from L3DT both as 8-bit grayscale and 16-bit raw formats [[BR]]
— Multiple alpha maps for texture splatting support [[BR]]
— Per texture detail map support [[BR]]
— Transform feedback based visibility culling for vegetation [[BR]]
— Alpha-map based vegetation placing on terrain [[BR]]
— Water now uses a refraction map instead of alpha blending for better refraction effects [[BR]]
[[BR]]
- SceneGraph improvements: [[BR]]
— Better bounding box updates from child to parent [[BR]]
— Better onDraw / postDraw implementation [[BR]]
[[BR]]
- Performance improvements: [[BR]]
— Batch 2D rendering tasks together as much as possible[[BR]]
— Improve renderStateBlock hash generation for better sorting [[BR]]
— Move most state related gfx changes from API implementation to the GFXDevice class [[BR]]
— Move viewport stack to the GFXDevice class [[BR]]
— Added various performance counters (frame duration with round-robin query system, draw call count, etc) [[BR]]
— Fixed and improved clip plane management [[BR]]
— Delete client-side texture data after GPU upload [[BR]]
[[BR]]
- New features: [[BR]]
— Added callback support to the Task class so that a specific task may call a function in the main thread upon completion [[BR]]
— Added mouse-wheel zoom support to Orbit/ThirdPerson cameras [[BR]]
— Added 2D Texture Array support (e.g. used for terrain textures) [[BR]]

249 Diff Diff k1ngp1n picture k1ngp1n Mon 31 Mar, 2014 20:42:31 +0000

[Ionut] [[BR]]
- Migrated to platform toolset v100 [[BR]]
- Updated boost to 1.55 [[BR]]
- Moved from “NULL” to “nullptr” [[BR]]
- DevIL is now linked dynamically [[BR]]

242 Diff Diff k1ngp1n picture k1ngp1n Mon 03 Feb, 2014 21:05:28 +0000

[Ionut] [[BR]]
- Smoother third person camera [[BR]]
- Smoother Character movement [[BR]]
- Limit third person camera rotations (-179 ... + 179 yaw, -31.5 ... +60 pitch) [[BR]]
- Character and third person camera performance optimizations [[BR]]

241 k1ngp1n picture k1ngp1n Sun 02 Feb, 2014 22:07:51 +0000

[Ionut] [[BR]]
- Implemented a basic ThirdPerson camera [[BR]]
— Does not limit rotations yet [[BR]]
— Does not have on click and drag functionality yet [[BR]]