Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/orbweaver/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 26, 2019
2 parents 439edd3 + 54558ef commit cb8f79b
Show file tree
Hide file tree
Showing 32 changed files with 2,281 additions and 848 deletions.
Binary file added doc/img/EntityList.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/FilterEditor.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_flipx.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_flipy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_flipz.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_rotatex.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_rotatey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/brush_rotatez.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/select_mouseresize.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/select_mouserotate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/select_mousetranslate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
483 changes: 483 additions & 0 deletions doc/manual.adoc

Large diffs are not rendered by default.

873 changes: 859 additions & 14 deletions doc/manual.html

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions include/ifilesystem.h
Expand Up @@ -80,6 +80,13 @@ struct FileInfo
else
return topDir + (topDir.back() == '/' ? "" : "/") + name;
}

/// Equality comparison with another FileInfo
bool operator== (const FileInfo& rhs) const
{
return topDir == rhs.topDir && name == rhs.name
&& visibility == rhs.visibility;
}
};

/**
Expand Down
17 changes: 9 additions & 8 deletions radiant/Makefile.am
Expand Up @@ -14,6 +14,9 @@ VFS_SOURCES = vfs/DeflatedInputStream.cpp \
vfs/DirectoryArchive.cpp \
vfs/Doom3FileSystem.cpp \
vfs/ZipArchive.cpp
SHADERS_SOURCES = shaders/Doom3ShaderLayer.cpp \
shaders/TableDefinition.cpp \
shaders/textures/GLTextureManager.cpp

# DarkRadiant executable
bin_PROGRAMS = darkradiant
Expand Down Expand Up @@ -205,9 +208,7 @@ darkradiant_SOURCES = main.cpp \
scenegraph/SceneGraphFactory.cpp \
shaders/CameraCubeMapDecl.cpp \
shaders/textures/TextureManipulator.cpp \
shaders/textures/GLTextureManager.cpp \
shaders/Doom3ShaderLayer.cpp \
shaders/TableDefinition.cpp \
$(SHADERS_SOURCES) \
shaders/ShaderTemplate.cpp \
shaders/MapExpression.cpp \
shaders/CShader.cpp \
Expand Down Expand Up @@ -448,15 +449,15 @@ darkradiant_SOURCES = main.cpp \
model/ScaledModelExporter.cpp \
model/NullModelNode.cpp

check_PROGRAMS = facePlaneTest vfsTest
check_PROGRAMS = facePlaneTest vfsTest shadersTest
TESTS = $(check_PROGRAMS)

facePlaneTest_SOURCES = test/facePlaneTest.cpp \
brush/FacePlane.cpp
facePlaneTest_LDADD = $(top_builddir)/libs/math/libmath.la

vfsTest_SOURCES = test/vfsTest.cpp $(VFS_SOURCES) \
shaders/Doom3ShaderLayer.cpp \
shaders/TableDefinition.cpp \
shaders/textures/GLTextureManager.cpp
vfsTest_SOURCES = test/vfsTest.cpp $(VFS_SOURCES)
vfsTest_LDFLAGS = $(FILESYSTEM_LIBS) $(Z_LIBS)

shadersTest_SOURCES = test/shadersTest.cpp $(SHADERS_SOURCES) $(VFS_SOURCES)
shadersTest_LDFLAGS = $(FILESYSTEM_LIBS) $(Z_LIBS)
287 changes: 146 additions & 141 deletions radiant/camera/CamWnd.cpp

Large diffs are not rendered by default.

153 changes: 77 additions & 76 deletions radiant/camera/CamWnd.h
Expand Up @@ -35,59 +35,59 @@ namespace ui

class CamWnd :
public ICameraView,
public scene::Graph::Observer,
public util::Noncopyable,
public scene::Graph::Observer,
public util::Noncopyable,
public sigc::trackable,
private wxutil::XmlResourceBasedWidget,
public wxEvtHandler,
private wxutil::XmlResourceBasedWidget,
public wxEvtHandler,
protected wxutil::MouseToolHandler
{
private:
// Overall panel including toolbar and GL widget
wxPanel* _mainWxWidget;
// Overall panel including toolbar and GL widget
wxPanel* _mainWxWidget;

// The ID of this window
int _id;
// The ID of this window
int _id;

static int _maxId;
static int _maxId;

render::View _view;
render::View _view;

// The contained camera
Camera _camera;
// The contained camera
Camera _camera;

RadiantCameraView _cameraView;
RadiantCameraView _cameraView;

static ShaderPtr _faceHighlightShader;
static ShaderPtr _primitiveHighlightShader;
static ShaderPtr _faceHighlightShader;
static ShaderPtr _primitiveHighlightShader;

wxutil::FreezePointer _freezePointer;
wxutil::FreezePointer _freezePointer;

// Is true during an active drawing process
bool _drawing;
// Is true during an active drawing process
bool _drawing;

bool _freeMoveEnabled;
bool _freeMoveEnabled;

// The GL widget
wxutil::GLWidget* _wxGLWidget;
wxutil::GLWidget* _wxGLWidget;

std::size_t _mapValidHandle;
std::size_t _mapValidHandle;

wxTimer _timer;
wxTimer _timer;
bool _timerLock; // to avoid double-timer-firings

sigc::connection _glExtensionsInitialisedNotifier;
sigc::connection _glExtensionsInitialisedNotifier;

wxutil::KeyEventFilterPtr _escapeListener;

public:
// Constructor and destructor
CamWnd(wxWindow* parent);
// Constructor and destructor
CamWnd(wxWindow* parent);

virtual ~CamWnd();
virtual ~CamWnd();

// The unique ID of this camwindow
int getId();
// The unique ID of this camwindow
int getId();

// ICameraView implementation
SelectionTestPtr createSelectionTestForPoint(const Vector2& point) override;
Expand All @@ -97,59 +97,59 @@ class CamWnd :
void queueDraw() override;
void forceRedraw() override;

void draw();
void update();
void draw();
void update();

// The callback when the scene gets changed
void onSceneGraphChange() override;
// The callback when the scene gets changed
void onSceneGraphChange() override;

static void captureStates();
static void releaseStates();
static void captureStates();
static void releaseStates();

Camera& getCamera();
Camera& getCamera();

Vector3 getCameraOrigin() const override;
void setCameraOrigin(const Vector3& origin) override;
Vector3 getCameraOrigin() const override;
void setCameraOrigin(const Vector3& origin) override;

Vector3 getRightVector() const override;
Vector3 getUpVector() const override;
Vector3 getForwardVector() const override;
Vector3 getRightVector() const override;
Vector3 getUpVector() const override;
Vector3 getForwardVector() const override;

Vector3 getCameraAngles() const;
void setCameraAngles(const Vector3& angles);
Vector3 getCameraAngles() const;
void setCameraAngles(const Vector3& angles);

const Frustum& getViewFrustum() const;

// greebo: This measures the rendering time during a 360° turn of the camera.
void benchmark();
// greebo: This measures the rendering time during a 360° turn of the camera.
void benchmark();

// This tries to find brushes above/below the current camera position and moves the view upwards/downwards
void changeFloor(const bool up);
// This tries to find brushes above/below the current camera position and moves the view upwards/downwards
void changeFloor(const bool up);

wxutil::GLWidget* getwxGLWidget() const { return _wxGLWidget; }
wxWindow* getMainWidget() const;
wxutil::GLWidget* getwxGLWidget() const { return _wxGLWidget; }
wxWindow* getMainWidget() const;

void enableFreeMove() override;
void disableFreeMove() override;
bool freeMoveEnabled() const override;
void enableFreeMove() override;
void disableFreeMove() override;
bool freeMoveEnabled() const override;

void jumpToObject(SelectionTest& selectionTest);
void jumpToObject(SelectionTest& selectionTest);

// Enables/disables the (ordinary) camera movement (non-freelook)
void addHandlersMove();
void removeHandlersMove();
// Enables/disables the (ordinary) camera movement (non-freelook)
void addHandlersMove();
void removeHandlersMove();

void enableDiscreteMoveEvents();
void enableFreeMoveEvents();
void disableDiscreteMoveEvents();
void disableFreeMoveEvents();
void enableDiscreteMoveEvents();
void enableFreeMoveEvents();
void disableDiscreteMoveEvents();
void disableFreeMoveEvents();

// Increases/decreases the far clip plane distance
void farClipPlaneIn();
void farClipPlaneOut();
// Increases/decreases the far clip plane distance
void farClipPlaneIn();
void farClipPlaneOut();

void startRenderTime();
void stopRenderTime();
void startRenderTime();
void stopRenderTime();

protected:
// Required overrides being a MouseToolHandler
Expand All @@ -166,31 +166,32 @@ class CamWnd :
void setFarClipButtonSensitivity();
void onRenderModeButtonsChanged(wxCommandEvent& ev);
void updateActiveRenderModeButton();
void onFarClipPlaneOutClick(wxCommandEvent& ev);
void onFarClipPlaneInClick(wxCommandEvent& ev);
void onStartTimeButtonClick(wxCommandEvent& ev);
void onStopTimeButtonClick(wxCommandEvent& ev);
void onFarClipPlaneOutClick(wxCommandEvent& ev);
void onFarClipPlaneInClick(wxCommandEvent& ev);
void onStartTimeButtonClick(wxCommandEvent& ev);
void onStopTimeButtonClick(wxCommandEvent& ev);
void updateToolbarVisibility();

void Cam_Draw();
void onRender();
void drawTime();
void Cam_Draw();
void onRender();
void drawTime();

CameraMouseToolEvent createMouseEvent(const Vector2& point, const Vector2& delta = Vector2(0, 0));

void onGLResize(wxSizeEvent& ev);
void onGLResize(wxSizeEvent& ev);

void onMouseScroll(wxMouseEvent& ev);
void onMouseScroll(wxMouseEvent& ev);

void onGLMouseButtonPress(wxMouseEvent& ev);
void onGLMouseButtonRelease(wxMouseEvent& ev);
void onGLMouseButtonRelease(wxMouseEvent& ev);
void onGLMouseMove(wxMouseEvent& ev);

// Mouse motion callback used in freelook mode only, processes deltas
void handleGLMouseMoveFreeMoveDelta(int x, int y, unsigned int state);

void onGLExtensionsInitialised();
void onGLExtensionsInitialised();

void onFrame(wxTimerEvent& ev);
void onFrame(wxTimerEvent& ev);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion radiant/modelfile/RenderablePicoModel.cpp
Expand Up @@ -95,7 +95,7 @@ void RenderablePicoModel::foreachVisibleSurface(const std::function<void(const S
// Check if the surface's shader is filtered, if not then submit it for rendering
const MaterialPtr& surfaceShader = surface.shader->getMaterial();

if (surfaceShader->isVisible())
if (surfaceShader && surfaceShader->isVisible())
{
func(surface);
}
Expand Down
2 changes: 1 addition & 1 deletion radiant/shaders/CShader.cpp
Expand Up @@ -22,7 +22,7 @@ namespace shaders
*/
CShader::CShader(const std::string& name, const ShaderDefinition& definition) :
_template(definition.shaderTemplate),
_fileName(definition.filename),
_fileName(definition.file.name),
_name(name),
m_bInUse(false),
_visible(true)
Expand Down
8 changes: 2 additions & 6 deletions radiant/shaders/Doom3ShaderSystem.cpp
Expand Up @@ -99,14 +99,10 @@ ShaderLibraryPtr Doom3ShaderSystem::loadMaterialFiles()
ShaderLibraryPtr library = std::make_shared<ShaderLibrary>();

// Load each file from the global filesystem
ShaderFileLoader<ShaderLibrary> loader(sPath, *library);
{
ScopedDebugTimer timer("ShaderFiles parsed: ");
GlobalFileSystem().forEachFile(
sPath, extension,
[&](const vfs::FileInfo& fileInfo) { loader.addFile(fileInfo); },
0
);
ShaderFileLoader<ShaderLibrary> loader(GlobalFileSystem(), *library,
sPath, extension);
loader.parseFiles();
}

Expand Down
28 changes: 14 additions & 14 deletions radiant/shaders/ShaderDefinition.h
@@ -1,5 +1,6 @@
#ifndef SHADERDEFINITION_H_
#define SHADERDEFINITION_H_
#pragma once

#include "ifilesystem.h"

#include <map>
#include <string>
Expand All @@ -14,23 +15,22 @@ namespace shaders
*/
struct ShaderDefinition
{
// The shader template
ShaderTemplatePtr shaderTemplate;
// The shader template
ShaderTemplatePtr shaderTemplate;

// Filename from which the shader was parsed
std::string filename;
// File from which the shader was parsed
vfs::FileInfo file;

/* Constructor
*/
ShaderDefinition(const ShaderTemplatePtr& templ, const std::string& fname) :
shaderTemplate(templ),
filename(fname)
{}
/* Constructor
*/
explicit ShaderDefinition(const ShaderTemplatePtr& templ,
const vfs::FileInfo& f = vfs::FileInfo()):
shaderTemplate(templ),
file(f)
{}

};

typedef std::map<std::string, ShaderDefinition, ShaderNameCompareFunctor> ShaderDefinitionMap;

}

#endif /*SHADERDEFINITION_H_*/

0 comments on commit cb8f79b

Please sign in to comment.