Antkeeper  0.0.1
material-property.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
22 
23 namespace render {
24 
26  input(nullptr)
27 {}
28 
30 {
31  if (!input || input->get_data_type() != get_data_type())
32  {
33  return false;
34  }
35 
36  this->input = input;
37 
38  return true;
39 }
40 
42 {
43  this->input = nullptr;
44 }
45 
46 } // namespace render
Port through which data can be uploaded to shader variables.
bool connect(const gl::shader_input *input)
Connects the material property to a shader input.
const gl::shader_input * input
void disconnect()
Disconnects the material property from its shader input.
virtual gl::shader_variable_type get_data_type() const =0
Returns the type of data which the property contains.
Input devices, events, and mapping.
High-level rendering.