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
#include "Headers/ThirdPersonCamera.h"
#include "Core/Math/Headers/Transform.h"
#include "Graphs/Headers/SceneGraphNode.h"
#include "Platform/Input/Headers/InputInterface.h"

namespace Divide {

ThirdPersonCamera::ThirdPersonCamera(const vec3<F32>& eye) : OrbitCamera(THIRD_PERSON, eye)
{
}

void ThirdPersonCamera::onActivate() {
    Application::getInstance().snapCursorToCenter();
    OrbitCamera::onActivate();
}

bool ThirdPersonCamera::mouseMoved(const Input::MouseEvent& arg) {
    static vec2<F32> mousePos;
    static const F32 rotationLimitRollLower = M_PI * 0.30f - RADIANS(1);
    static const F32 rotationLimitRollUpper = M_PI * 0.175f - RADIANS(1);
    static const F32 rotationLimitYaw = M_PI - RADIANS(1);

    mousePos.set(arg.state.X.rel, arg.state.Y.rel);

    Application::getInstance().snapCursorToCenter();

    if (IS_ZERO(mousePos.x) && IS_ZERO(mousePos.y)) {
        return OrbitCamera::mouseMoved(arg);
    }

    mousePos.set((mousePos / _mouseSensitivity) * _turnSpeedFactor);

    if (!IS_ZERO(mousePos.y)) {
        F32 targetRoll = _cameraRotation.roll - mousePos.y;
        if (targetRoll > -rotationLimitRollLower && targetRoll < rotationLimitRollUpper) {
            _cameraRotation.roll -= mousePos.y; //why roll? beats me.
            _rotationDirty = true;
        }
    }

    if (!IS_ZERO(mousePos.x)) {
        F32 targetYaw = _cameraRotation.yaw - mousePos.x;
        if (targetYaw > -rotationLimitYaw && targetYaw < rotationLimitYaw) {
            _cameraRotation.yaw -= mousePos.x;
            _rotationDirty = true;
        }
    }
     
    if (_rotationDirty) {
        Util::normalize(_cameraRotation, false,true, false, true);
    }

    return OrbitCamera::mouseMoved(arg);
}

};

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

Diff revisions: vs.
Revision Author Commited Message
334 Diff Diff IonutCava picture IonutCava Wed 10 Dec, 2014 17:21:22 +0000

[Ionut]
- Reorganized the Hardware project and renamed to "Platform"
- Reorganized the Server project

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)

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

303 Diff Diff IonutCava picture IonutCava Sat 09 Aug, 2014 19:12:32 +0000

[Ionut]
- Fixed mouse movement (change resolution callback properly informs inputInterface of the new window’s width and height)
- Fixed immediate mode emulation rendering (destroyed index buffers for some reason)
- Added axis gizmos for Scene / Scene + Selected Object / Scene + All object cycled via the F5 key in debug

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]]

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 Diff Diff 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]]

235 Diff Diff k1ngp1n picture k1ngp1n Thu 16 Jan, 2014 22:31:48 +0000

[Ionut] [[BR]]
- W.I.P. anti-stuck system for agents [[BR]]
- Fixed lerp functions in math classes [[BR]]
- Used lerp-based translation for Character class [[BR]]
- Code cleanups and utility functions [[BR]]

170 k1ngp1n picture k1ngp1n Sun 03 Nov, 2013 17:24:57 +0000

-Moved hardware related code to a separate project [[BR]]
-More work on post-processing: [[BR]]
— HDR rendering is working, but final tonemapping needs more work [[BR]]
-Important changes in BloomPreRenderOperator.cpp, PostFX.cpp and glFrameBufferObject.cpp [[BR]]
-Trailing and leading whitespace cleanups [[BR]]