-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace GenericShader with Magnum's Flat shader.
The goal of this commit is to preserve current visual output while porting to Magnum's builtin functionality, in order to ensure no regression happened before we jump on more complex shaders. There's one feature of the GenericShader that still has to wait for changes on Magnum side and that's the primitive ID texturing used by PLY files. The relevant shader code is separated into a new PrimitiveIDTextured{Shader,Drawable} where it will temporarily live until Magnum can handle this as well.
- Loading branch information
Showing
14 changed files
with
199 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#include "PrimitiveIDTexturedDrawable.h" | ||
#include "PrimitiveIDTexturedShader.h" | ||
#include "esp/scene/SceneNode.h" | ||
|
||
namespace esp { | ||
namespace gfx { | ||
|
||
PrimitiveIDTexturedDrawable::PrimitiveIDTexturedDrawable( | ||
scene::SceneNode& node, | ||
PrimitiveIDTexturedShader& shader, | ||
Magnum::GL::Mesh& mesh, | ||
Magnum::SceneGraph::DrawableGroup3D* group /* = nullptr */, | ||
Magnum::GL::Texture2D* texture /* = nullptr */) | ||
: Drawable{node, shader, mesh, group}, texture_(texture) {} | ||
|
||
void PrimitiveIDTexturedDrawable::draw( | ||
const Magnum::Matrix4& transformationMatrix, | ||
Magnum::SceneGraph::Camera3D& camera) { | ||
PrimitiveIDTexturedShader& shader = | ||
static_cast<PrimitiveIDTexturedShader&>(shader_); | ||
shader | ||
.setTransformationProjectionMatrix(camera.projectionMatrix() * | ||
transformationMatrix) | ||
.bindTexture(*texture_); | ||
|
||
mesh_.draw(shader_); | ||
} | ||
|
||
} // namespace gfx | ||
} // namespace esp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Facebook, Inc. and its affiliates. | ||
// This source code is licensed under the MIT license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
|
||
#pragma once | ||
|
||
#include "Drawable.h" | ||
|
||
namespace esp { | ||
namespace gfx { | ||
|
||
class PrimitiveIDTexturedShader; | ||
|
||
class PrimitiveIDTexturedDrawable : public Drawable { | ||
public: | ||
//! Create a GenericDrawable for the given object using shader and mesh. | ||
//! Adds drawable to given group and uses provided texture, objectId, and | ||
//! color for textured, object id buffer and color shader output respectively | ||
explicit PrimitiveIDTexturedDrawable( | ||
scene::SceneNode& node, | ||
PrimitiveIDTexturedShader& shader, | ||
Magnum::GL::Mesh& mesh, | ||
Magnum::SceneGraph::DrawableGroup3D* group = nullptr, | ||
Magnum::GL::Texture2D* texture = nullptr); | ||
|
||
protected: | ||
virtual void draw(const Magnum::Matrix4& transformationMatrix, | ||
Magnum::SceneGraph::Camera3D& camera) override; | ||
|
||
Magnum::GL::Texture2D* texture_; | ||
}; | ||
|
||
} // namespace gfx | ||
} // namespace esp |
Oops, something went wrong.