Material.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_GRAPHICS_MATERIAL_H
#define SURGSIM_GRAPHICS_MATERIAL_H
#include <memory>
#include <set>
#include "SurgSim/Framework/Component.h"
namespace SurgSim
{
namespace Graphics
{
class UniformBase;
class Program;
class Material : public SurgSim::Framework::Component
{
public:
explicit Material(const std::string& name) : Component(name) {}
// (Note that Visual Studio does not support "= default" yet.)
virtual ~Material()
{
}
virtual void addUniform(std::shared_ptr<UniformBase> uniform) = 0;
virtual void addUniform(const std::string& type, const std::string& name) = 0;
virtual bool removeUniform(std::shared_ptr<UniformBase> uniform) = 0;
virtual bool removeUniform(const std::string& name) = 0;
virtual std::shared_ptr<UniformBase> getUniform(const std::string& name) const = 0;
virtual std::shared_ptr<UniformBase> getUniform(size_t index) const = 0;
virtual bool hasUniform(const std::string& name) const = 0;
virtual size_t getNumUniforms() const = 0;
virtual bool setProgram(std::shared_ptr<Program> program) = 0;
virtual std::shared_ptr<Program> getProgram() const = 0;
virtual void clearProgram() = 0;
};
}; // namespace Graphics
}; // namespace SurgSim
#endif // SURGSIM_GRAPHICS_MATERIAL_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Graphics::Material::~Material
virtual ~Material()
Destructor.
Definition: Material.h:48
SurgSim::Framework::Component::Component
Component(const std::string &name)
Constructor.
Definition: Component.cpp:34
SurgSim::Graphics::Material::getNumUniforms
virtual size_t getNumUniforms() const =0
Returns the number of uniforms in this material.
Component.h
SurgSim::Framework::Component
Component is the main interface class to pass information to the system managers each will decide whe...
Definition: Component.h:42
SurgSim::Graphics::Material
Base class that defines the interface for graphics materials.
Definition: Material.h:39
SurgSim::Graphics::Material::getProgram
virtual std::shared_ptr< Program > getProgram() const =0
Gets the program used by this material.
SurgSim::Graphics::Material::setProgram
virtual bool setProgram(std::shared_ptr< Program > program)=0
Sets the program used by this material.
SurgSim::Graphics::Material::addUniform
virtual void addUniform(std::shared_ptr< UniformBase > uniform)=0
Adds a uniform to this material.
SurgSim::Graphics::Material::Material
Material(const std::string &name)
Constructor.
Definition: Material.h:44
SurgSim::Graphics::Material::removeUniform
virtual bool removeUniform(std::shared_ptr< UniformBase > uniform)=0
Removes a uniform from this material.
SurgSim::Graphics::Material::clearProgram
virtual void clearProgram()=0
Removes the shader from the material, falling back to fixed-function pipeline.
SurgSim::Graphics::Material::getUniform
virtual std::shared_ptr< UniformBase > getUniform(const std::string &name) const =0
Gets a uniform in this material.
SurgSim::Graphics::Material::hasUniform
virtual bool hasUniform(const std::string &name) const =0
Checks if this material has a uniform with the given name.