repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
wanghuan578/chrome-gn
src/gn/deps_iterator.cc
<reponame>wanghuan578/chrome-gn // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/deps_iterator.h" #include "gn/target.h" DepsIterator::DepsIterator() : current_index_(0) { vect_stack_[0]...
wanghuan578/chrome-gn
src/gn/desc_builder.cc
// Copyright (c) 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <memory> #include <set> #include "base/json/json_writer.h" #include "base/strings/string_number_conversions.h" #include "gn/commands.h" #inc...
wanghuan578/chrome-gn
src/gn/command_outputs.cc
<reponame>wanghuan578/chrome-gn<gh_stars>10-100 // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <stddef.h> #include <algorithm> #include "base/command_line.h" #include "base/strings/stringpri...
wanghuan578/chrome-gn
src/gn/function_filter.cc
<filename>src/gn/function_filter.cc // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <stddef.h> #include "gn/err.h" #include "gn/filesystem_utils.h" #include "gn/functions.h" #include "gn/parse...
wanghuan578/chrome-gn
src/gn/metadata_walk.cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/metadata_walk.h" std::vector<Value> WalkMetadata( const UniqueVector<const Target*>& targets_to_walk, const std::vector<std::string>...
wanghuan578/chrome-gn
src/base/memory/ref_counted.cc
// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/memory/ref_counted.h" namespace base { namespace subtle { bool RefCountedThreadSafeBase::HasOneRef() const { return ref_count_.IsO...
wanghuan578/chrome-gn
src/gn/config_unittest.cc
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/config.h" #include "gn/test_with_scope.h" #include "util/test/test.h" // Tests that the "resolved" values are the same as "own" values when ...
wanghuan578/chrome-gn
src/gn/command_format.cc
<reponame>wanghuan578/chrome-gn // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/command_format.h" #include <stddef.h> #include <sstream> #include "base/command_line.h" #include "base/fil...
wanghuan578/chrome-gn
src/gn/setup_unittest.cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/setup.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp...
wanghuan578/chrome-gn
src/gn/hash_table_base_unittest.cc
<gh_stars>10-100 // Copyright (c) 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "hash_table_base.h" #include "util/test/test.h" #include <algorithm> #include <vector> // This unit-test is also used to ...
wanghuan578/chrome-gn
src/gn/version.cc
<reponame>wanghuan578/chrome-gn // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/version.h" #include <iostream> #include <string_view> #include <tuple> #include "base/strings/string_number_...
wanghuan578/chrome-gn
src/base/value_iterators.cc
<reponame>wanghuan578/chrome-gn<filename>src/base/value_iterators.cc // Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/value_iterators.h" namespace base { namespace detail { // ---------...
wanghuan578/chrome-gn
src/gn/json_project_writer_unittest.cc
<reponame>wanghuan578/chrome-gn<filename>src/gn/json_project_writer_unittest.cc // Copyright (c) 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/json_project_writer.h" #include "base/strings/string_util...
wanghuan578/chrome-gn
src/gn/ninja_rust_binary_target_writer.cc
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/ninja_rust_binary_target_writer.h" #include <sstream> #include "base/strings/string_util.h" #include "gn/deps_iterator.h" #include "gn/file...
wanghuan578/chrome-gn
src/gn/function_set_defaults.cc
<gh_stars>10-100 // Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/err.h" #include "gn/functions.h" #include "gn/parse_tree.h" #include "gn/scope.h" namespace functions { const char kSe...
wanghuan578/chrome-gn
src/gn/version_unittest.cc
<filename>src/gn/version_unittest.cc // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/version.h" #include "util/test/test.h" TEST(VersionTest, FromString) { Version v0_0_1{0, 0, 1}; AS...
wanghuan578/chrome-gn
src/gn/command_clean_stale.cc
<gh_stars>10-100 // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <optional> #include "base/command_line.h" #include "base/files/file_path.h" #include "gn/commands.h" #include "gn/err.h" #inclu...
wanghuan578/chrome-gn
src/gn/frameworks_utils.cc
<reponame>wanghuan578/chrome-gn<gh_stars>10-100 // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/frameworks_utils.h" #include "gn/filesystem_utils.h" namespace { // Name of the extension ...
wanghuan578/chrome-gn
src/gn/ninja_target_command_util_unittest.cc
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/ninja_target_command_util.h" #include <algorithm> #include <sstream> #include "util/build_config.h" #include "util/test/test.h" namespace ...
wanghuan578/chrome-gn
src/gn/function_foreach.cc
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/err.h" #include "gn/functions.h" #include "gn/parse_tree.h" #include "gn/scope.h" namespace functions { const char kForEach[] = "foreac...
wanghuan578/chrome-gn
src/gn/rust_values.cc
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/rust_tool.h" #include "gn/rust_values.h" #include "gn/target.h" RustValues::RustValues() : crate_type_(RustValues::CRATE_AUTO) {} RustValue...
wanghuan578/chrome-gn
src/gn/metadata.cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/metadata.h" #include "gn/filesystem_utils.h" const char kMetadata_Help[] = R"(Metadata Collection Metadata is information attached t...
wanghuan578/chrome-gn
src/gn/function_filter_unittest.cc
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/functions.h" #include "gn/test_with_scope.h" #include "util/build_config.h" #include "util/test/test.h" TEST(FilterExcludeTest, Filter) { ...
wanghuan578/chrome-gn
src/gn/compile_commands_writer_unittest.cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/compile_commands_writer.h" #include <memory> #include <sstream> #include <utility> #include "gn/config.h" #include "gn/ninja_target_command...
wanghuan578/chrome-gn
src/gn/source_file_unittest.cc
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "gn/source_file.h" #include "util/test/test.h" // The SourceFile object should normalize the input passed to the constructor. // The normalizer...
jlwitthuhn/cycles-shader-editor
src/subwindow_node_list.cpp
<filename>src/subwindow_node_list.cpp #include "subwindow_node_list.h" #include <string> #include <utility> #include <nanovg.h> #include <GLFW/glfw3.h> #include "config.h" #include "button_category.h" #include "buttons_nodes.h" #include "gui_sizes.h" #include "node_base.h" #include "node_colors.h" #include "node_co...
jlwitthuhn/cycles-shader-editor
src/util_vector.cpp
<reponame>jlwitthuhn/cycles-shader-editor<gh_stars>10-100 #include "util_vector.h" #include <algorithm> float cse::Float2::magnitude_squared() const { return x * x + y * y; } cse::Float2 cse::Float2::clamp_to(const Float2& a, const Float2& b) const { const float lo_x_in = std::min(a.x, b.x); const float lo_y_in =...
jlwitthuhn/cycles-shader-editor
src/wrapper_nvg_context.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "wrapper_nvg_context.h" #define NANOVG_GL2_IMPLEMENTATION #include <GL/glew.h> #include <nanovg_gl.h> cse::NvgContext::NvgContext() : context_ptr(nvgCreateGL2(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG)) { } cse::NvgContext::~NvgContext() { if (context_ptr ...
jlwitthuhn/cycles-shader-editor
src/node_colors.cpp
<gh_stars>10-100 #include "node_colors.h" #include <map> #include <memory> #include <string> #include <vector> #include "config.h" #include "curve.h" #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::MixRGBNode::MixRGBNode(const Float2 position) : EditableNode(NodeCategory...
jlwitthuhn/cycles-shader-editor
src/node_textures.cpp
#include "node_textures.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::BrickTextureNode::BrickTextureNode(const Float2 position) : EditableNode(NodeCategory::TEXTURE, CyclesNodeType::BrickTex, "Brick Texture") { world_pos = positi...
jlwitthuhn/cycles-shader-editor
src/widget_radio_list.cpp
<gh_stars>10-100 #include "widget_radio_list.h" #include <cmath> #include <GLFW/glfw3.h> #include <nanovg.h> #include "gui_sizes.h" #include "sockets.h" #include "wrapper_nvg_func.h" cse::RadioListWidget::RadioListWidget(const float width) : width(width) { } void cse::RadioListWidget::attach_value(const std::weak...
jlwitthuhn/cycles-shader-editor
src/util_platform.cpp
<gh_stars>10-100 #include "util_platform.h" #ifdef _WIN32 #include <Windows.h> #else #include <unistd.h> #endif #include <GLFW/glfw3.h> #include <nanovg.h> #include "wrapper_nvg_context.h" cse::PathString cse::Platform::get_pathstring(const std::string& input) { #ifdef _WIN32 return std::wstring(input.begin(), inp...
jlwitthuhn/cycles-shader-editor
src/view.cpp
#include "view.h" #include <cmath> #include <cstdio> #include <list> #include <GLFW/glfw3.h> #include <nanovg.h> #include "drawing.h" #include "editable_graph.h" #include "node_base.h" #include "selection.h" #include "sockets.h" #include "subwindow_node_list.h" #include "ui_requests.h" #include "util_area.h" #includ...
jlwitthuhn/cycles-shader-editor
src/node_interop_max.cpp
<filename>src/node_interop_max.cpp #include "node_interop_max.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::MaxTexmapShaderNode::MaxTexmapShaderNode(const Float2 position) : EditableNode(NodeCategory::TEXTURE, CyclesNodeType::MaxT...
jlwitthuhn/cycles-shader-editor
src/graph_decoder.cpp
#include "graph_decoder.h" #include <list> #include <memory> #include "node_base.h" #include "serialize.h" cse::CyclesNodeGraph::CyclesNodeGraph(const std::string& encoded_graph) { // Temporary storage to fill during deserialization std::list<std::shared_ptr<EditableNode>> tmp_nodes; std::list<NodeConnection> tmp...
jlwitthuhn/cycles-shader-editor
src/statusbar.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "statusbar.h" #include <nanovg.h> cse::NodeEditorStatusBar::NodeEditorStatusBar() { status_text = "Node graph editor loaded"; } void cse::NodeEditorStatusBar::draw(NVGcontext* const draw_context, const float width) { // Panel nvgBeginPath(draw_context); nvgRoun...
jlwitthuhn/cycles-shader-editor
src/subwindow_param_editor.cpp
#include "subwindow_param_editor.h" #include <memory> #include <string> #include <GLFW/glfw3.h> #include <nanovg.h> #include "gui_sizes.h" #include "panel_edit.h" #include "panel_edit_bool.h" #include "panel_edit_color.h" #include "panel_edit_color_ramp.h" #include "panel_edit_curve.h" #include "panel_edit_enum.h" #...
jlwitthuhn/cycles-shader-editor
src/main_window.cpp
<gh_stars>10-100 #include "main_window.h" #include <utility> #include <vector> #include <GL/glew.h> #include <GLFW/glfw3.h> #include <nanovg.h> #include "editable_graph.h" #include "glfw_callbacks.h" #include "gui_sizes.h" #include "node_base.h" #include "output.h" #include "serialize.h" #include "sockets.h" #includ...
jlwitthuhn/cycles-shader-editor
src/curve.cpp
#include "curve.h" #include <memory> #include "sockets.h" #include "util_enum.h" #include "util_hermite_spline.h" cse::CurveEvaluator::CurveEvaluator(CurveSocketValue* const curve_socket_val, const int segments) { const std::vector<Float2>& curve_control_points = curve_socket_val->curve_points; // No points, in t...
jlwitthuhn/cycles-shader-editor
src/panel_edit_color_ramp.cpp
#include "panel_edit_color_ramp.h" #include <algorithm> #include <cassert> #include <cmath> #include <cstring> #include <GLFW/glfw3.h> #include <nanovg.h> #include "drawing.h" #include "gui_sizes.h" #include "panel_edit_color.h" #include "sockets.h" #include "util_color_ramp.h" #include "util_enum.h" #include "util_...
jlwitthuhn/cycles-shader-editor
src/drawing.cpp
#include "drawing.h" #include <cmath> #include <iomanip> #include <sstream> #include <nanovg.h> #include "gui_sizes.h" #include "sockets.h" #include "util_area.h" #include "util_enum.h" #include "util_vector.h" #include "wrapper_nvg_func.h" void cse::Drawing::draw_button( NVGcontext* const draw_context, const Flo...
jlwitthuhn/cycles-shader-editor
src/util_parse.cpp
#include "util_parse.h" #include <sstream> float cse::locale_safe_stof(std::string input) { std::stringstream stream(input); float result = 0.0f; stream >> result; return result; }
jlwitthuhn/cycles-shader-editor
src/sockets.cpp
<filename>src/sockets.cpp #include "sockets.h" #include "curve.h" #include <algorithm> #include <cassert> #include <memory> static constexpr float CURVE_CREATE_POINT_IGNORE_MARGIN = 0.012f; static constexpr float CURVE_POINT_SELECT_MARGIN = 0.05f; static bool Float2_x_lt(const cse::Float2 a, const cse::Float2 b) { ...
jlwitthuhn/cycles-shader-editor
src/widget.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "widget.h" cse::Widget::Widget(const float width) : width(width) { } cse::Widget::~Widget() { } float cse::Widget::draw(NVGcontext*) { return 0.0f; } void cse::Widget::set_mouse_local_pos(const Float2 local_pos) { mouse_pos = local_pos; } bool cse::Widget::has...
jlwitthuhn/cycles-shader-editor
src/widget_multi_input.cpp
<filename>src/widget_multi_input.cpp #include "widget_multi_input.h" #include <GLFW/glfw3.h> #include <nanovg.h> #include "gui_sizes.h" #include "input_box.h" #include "sockets.h" static std::shared_ptr<cse::BaseInputBox> get_input_box_for_value(const std::shared_ptr<cse::SocketValue>& socket_value) { if (const aut...
jlwitthuhn/cycles-shader-editor
example/main.cpp
#include <graph_editor.h> #include <iostream> #include <string> int main() { cse::GraphEditor node_window; node_window.create_window(); while (node_window.run_window_loop_iteration()) { // Check if data is ready std::string graph; if (node_window.get_serialized_graph(graph)) { std::cout << "Graph saved...
jlwitthuhn/cycles-shader-editor
src/node_converter.cpp
<filename>src/node_converter.cpp #include "node_converter.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::BlackbodyNode::BlackbodyNode(const Float2 position) : EditableNode(NodeCategory::CONVERTER, CyclesNodeType::Blackbody, "Blackb...
jlwitthuhn/cycles-shader-editor
src/ui_requests.cpp
<gh_stars>10-100 #include "ui_requests.h" cse::ViewUIRequests::ViewUIRequests() { clear(); } void cse::ViewUIRequests::clear() { pan_left = false; pan_right = false; pan_up = false; pan_down = false; zoom_in = false; zoom_out = false; } void cse::ViewUIRequests::operator|=(const ViewUIRequests& other) { pan...
jlwitthuhn/cycles-shader-editor
src/toolbar.cpp
#include "toolbar.h" #include <GLFW/glfw3.h> #include <nanovg.h> #include "drawing.h" #include "gui_sizes.h" #include "ui_requests.h" cse::ToolbarButton::ToolbarButton(const ToolbarButtonType type) { this->type = type; } std::string cse::ToolbarButton::get_label() const { switch (type) { case ToolbarButtonType::...
jlwitthuhn/cycles-shader-editor
extra/shader_graph_converter.cpp
// This file contains a few functions to enable converting a serialized shader graph to a ccl::ShaderGraph // It is separate from the editor because these functions depend on Cycles types and any code using them must be linked against Cycles ccl::ShaderGraph* create_shader_graph(std::string encoded_graph) { CyclesNod...
jlwitthuhn/cycles-shader-editor
src/node_vector.cpp
<gh_stars>10-100 #include "node_vector.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::BumpNode::BumpNode(const Float2 position) : EditableNode(NodeCategory::VECTOR, CyclesNodeType::Bump, "Bump") { world_pos = position; const aut...
jlwitthuhn/cycles-shader-editor
src/panel_edit_color.cpp
#include "panel_edit_color.h" #include <GLFW/glfw3.h> #include <nanovg.h> #include "drawing.h" #include "gui_sizes.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" #include "wrapper_nvg_func.h" cse::EditColorPanel::EditColorPanel(const float width) : EditParamPanel(width), color_rect_click_t...
jlwitthuhn/cycles-shader-editor
src/glfw_callbacks.cpp
#include "glfw_callbacks.h" #include <map> #include <mutex> #include <GLFW/glfw3.h> #include "main_window.h" std::mutex window_map_mutex; std::map<GLFWwindow*, cse::EditorMainWindow*> window_map; static cse::EditorMainWindow* get_main_window(GLFWwindow* const glfw_window) { std::lock_guard<std::mutex> lock(window...
jlwitthuhn/cycles-shader-editor
src/selection.cpp
#include "selection.h" #include "node_base.h" #include "util_vector.h" void cse::Selection::move_nodes(const Float2 delta) { for (const auto weak_node : nodes) { if (const auto this_node = weak_node.lock()) { this_node->world_pos += delta; } } } void cse::Selection::modify_selection(SelectMode mode, std::we...
jlwitthuhn/cycles-shader-editor
src/util_color_ramp.cpp
#include "util_color_ramp.h" cse::ColorRampPoint::ColorRampPoint(const float position, const Float3 color, const float alpha) : position(position), color(color), alpha(alpha) { }
jlwitthuhn/cycles-shader-editor
src/button_category.cpp
#include "button_category.h" #include <cmath> #include "drawing.h" cse::NodeCategoryButtonPlacer::NodeCategoryButtonPlacer(const Float2 draw_origin, const float parent_width, const float vertical_padding) { this->draw_origin = draw_origin; this->parent_width = parent_width; this->vertical_padding = vertical_paddi...
jlwitthuhn/cycles-shader-editor
src/node_inputs.cpp
#include "node_inputs.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::AmbientOcculsionNode::AmbientOcculsionNode(const Float2 position) : EditableNode(NodeCategory::INPUT, CyclesNodeType::AmbientOcclusion, "Ambient Occlusion") { wo...
jlwitthuhn/cycles-shader-editor
src/node_base.cpp
#include "node_base.h" #include <cmath> #include <map> #include "config.h" #include "curve.h" #include "drawing.h" #include "gui_colors.h" #include "gui_sizes.h" #include "sockets.h" #include "util_color_ramp.h" #include "util_enum.h" #include "util_vector.h" static cse::Float3 get_color_for_category(const cse::Node...
jlwitthuhn/cycles-shader-editor
src/graph_editor.cpp
#include "graph_editor.h" #include "main_window.h" cse::GraphEditor::GraphEditor() { main_window = std::make_unique<EditorMainWindow>(); const PathString default_font_path = Platform::get_pathstring("font"); set_font_search_path(default_font_path); } cse::GraphEditor::~GraphEditor() { // Empty destructor is need...
jlwitthuhn/cycles-shader-editor
src/panel_edit_bool.cpp
#include "panel_edit_bool.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::EditBoolPanel::EditBoolPanel(const float width) : EditParamPanel(width), radio_widget(width) { } bool cse::EditBoolPanel::is_active() const { return (attached_bool.expired() == false); } void cse::EditBoolPane...
jlwitthuhn/cycles-shader-editor
src/util_hermite_spline.cpp
<filename>src/util_hermite_spline.cpp #include "util_hermite_spline.h" // Cubic hermit spline interpolation // Code taken from https://blog.demofox.org/2015/08/08/cubic-hermite-interpolation/ cse::CubicHermiteSplineInterpolator::CubicHermiteSplineInterpolator(float A, float B, float C, float D) : a( -A / 2.0f + (3.0...
jlwitthuhn/cycles-shader-editor
src/node_outputs.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "node_outputs.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::MaterialOutputNode::MaterialOutputNode(const Float2 position) : EditableNode(NodeCategory::OUTPUT, CyclesNodeType::Mate...
jlwitthuhn/cycles-shader-editor
src/subwindow.cpp
#include "subwindow.h" #include <nanovg.h> #include "gui_sizes.h" cse::NodeEditorSubwindow::NodeEditorSubwindow(Float2 screen_position, std::string title) { subwindow_screen_pos = screen_position; this->title = title; } cse::Float2 cse::NodeEditorSubwindow::get_screen_pos() const { return subwindow_screen_pos; }...
jlwitthuhn/cycles-shader-editor
src/input_box.cpp
#include "input_box.h" #include <cctype> #include <iomanip> #include <sstream> #include <stdexcept> #include <nanovg.h> #include "gui_sizes.h" #include "sockets.h" #include "util_parse.h" const float INPUT_CORNER_RADIUS = 1.0f; cse::BaseInputBox::BaseInputBox(const float width, const float height) { this->width =...
jlwitthuhn/cycles-shader-editor
src/panel_edit.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "panel_edit.h" cse::EditParamPanel::EditParamPanel(const float width) : panel_width(width) { } float cse::EditParamPanel::get_width() const { return panel_width; } float cse::EditParamPanel::get_height() const { return panel_height; } void cse::EditParamPanel::...
jlwitthuhn/cycles-shader-editor
src/buttons_nodes.cpp
<filename>src/buttons_nodes.cpp #include "buttons_nodes.h" #include "drawing.h" #include "gui_sizes.h" float cse::NodeCreationButton::draw(NVGcontext* const draw_context, const Float2 draw_origin, const Float2 parent_local_mouse_pos, const float parent_width) { // Coordinates to draw the actual button at // This is...
jlwitthuhn/cycles-shader-editor
src/panel_edit_curve.cpp
<filename>src/panel_edit_curve.cpp #include "panel_edit_curve.h" #include <cmath> #include <vector> #include <GLFW/glfw3.h> #include <nanovg.h> #include "curve.h" #include "gui_sizes.h" #include "sockets.h" static cse::Float2 get_panel_space_point(const cse::Float2 normalized_point, const float hpad, const float vp...
jlwitthuhn/cycles-shader-editor
src/zoom.cpp
#include "zoom.h" #include <cassert> cse::ZoomManager::ZoomManager() { zooms.push_back(0.25f); zooms.push_back(0.325f); zooms.push_back(0.40f); zooms.push_back(0.50f); zooms.push_back(0.666667f); zooms.push_back(0.833333f); zooms.push_back(1.00f); zooms.push_back(1.25f); zooms.push_back(1.50f); zooms.push_b...
jlwitthuhn/cycles-shader-editor
src/panel_edit_multi_input.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "panel_edit_multi_input.h" #include <nanovg.h> #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::EditMultiInputPanel::EditMultiInputPanel(const float width) : EditParamPanel(width), input_widget(width) { } bool cse::EditMultiInputPanel::i...
jlwitthuhn/cycles-shader-editor
src/panel_edit_enum.cpp
#include "panel_edit_enum.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::EditEnumPanel::EditEnumPanel(const float width) : EditParamPanel(width), radio_widget(width) { } bool cse::EditEnumPanel::is_active() const { return attached_enum.use_count() > 0; } void cse::EditEnumPanel::pr...
jlwitthuhn/cycles-shader-editor
src/node_shaders.cpp
#include "node_shaders.h" #include <memory> #include <vector> #include "output.h" #include "sockets.h" #include "util_enum.h" #include "util_vector.h" cse::PrincipledBSDFNode::PrincipledBSDFNode(const Float2 position) : EditableNode(NodeCategory::SHADER, CyclesNodeType::PrincipledBSDF, "Principled BSDF") { world_po...
jlwitthuhn/cycles-shader-editor
src/undo.cpp
#include "undo.h" static const int UNDO_LIMIT = 50; void cse::UndoStack::push_undo_state(std::string state) { redo_state.clear(); undo_state.push_front(state); while (undo_state.size() > UNDO_LIMIT) { undo_state.pop_back(); } } std::string cse::UndoStack::pop_undo_state(std::string current_state) { if (undo_s...
jlwitthuhn/cycles-shader-editor
src/serialize.cpp
#include "serialize.h" #include <cassert> #include <cstddef> #include <map> #include <memory> #include <string> #include <sstream> #include <utility> #include "node_base.h" #include "node_colors.h" #include "node_converter.h" #include "node_inputs.h" #include "node_interop_max.h" #include "node_outputs.h" #include "n...
jlwitthuhn/cycles-shader-editor
src/util_area.cpp
<reponame>jlwitthuhn/cycles-shader-editor #include "util_area.h" #include <algorithm> cse::Area::Area(const Float2 a, const Float2 b) { const float min_x = std::min(a.x, b.x); const float min_y = std::min(a.y, b.y); const float max_x = std::max(a.x, b.x); const float max_y = std::max(a.y, b.y); lo = Float2(min_...
jlwitthuhn/cycles-shader-editor
src/editable_graph.cpp
#include "editable_graph.h" #include "node_outputs.h" #include "sockets.h" #include "util_vector.h" cse::EditableGraph::EditableGraph(const ShaderGraphType type) { reset(type); } void cse::EditableGraph::add_node(std::shared_ptr<EditableNode>& node, const Float2 world_pos) { if (node.use_count() == 0) { return; ...
akondas/mockcity
src/logger.hpp
#ifndef LOGGER_HPP #define LOGGER_HPP #include <cstdarg> #include <cstdint> #include <fstream> #include <iostream> #include <memory> #include <sstream> #include <string> enum class LogLevel : uint8_t { Debug, Info, Warning, Error, }; class Logger { public: Logger() = default; ~Log...
akondas/mockcity
src/game.cpp
#include <stack> #include <SFML/Graphics.hpp> #include <SFML/System.hpp> #include "audiomanager.hpp" #include "game.hpp" #include "game_state.hpp" #include "texture_manager.hpp" #include "animation_handler.hpp" #include "tile.hpp" Game::Game() { audio = std::make_unique<AudioManager>(); textures = std::make_...
akondas/mockcity
src/game.hpp
#ifndef GAME_HPP #define GAME_HPP #include <cstdint> #include <map> #include <memory> #include <string> #include <stack> #include <SFML/Graphics.hpp> #include "audiomanager.hpp" #include "texture_manager.hpp" #include "tile.hpp" constexpr uint16_t tileSize = 8; class GameState; class Game { public: Ga...
akondas/mockcity
src/tile.cpp
<filename>src/tile.cpp #include <SFML/Graphics.hpp> #include "animation_handler.hpp" #include "tile.hpp" void Tile::draw(sf::RenderWindow &window, float dt) { this->animHandler.changeAnim(this->tileVariant); this->animHandler.update(dt); this->sprite.setTextureRect(this->animHandler.bounds); window...
akondas/mockcity
src/map.cpp
<filename>src/map.cpp<gh_stars>1-10 #include "map.hpp" #include "inmemoryfile.hpp" void Map::load(const std::string &filename, unsigned int width, unsigned int height, std::map<std::string, Tile> &tileAtlas) { this->width = width; this->height = height; InMemoryFile file(filename); for (int pos = 0; p...
akondas/mockcity
src/game_state_editor.cpp
#include <SFML/Graphics.hpp> #include "game_state.hpp" #include "game_state_editor.hpp" GameStateEditor::GameStateEditor(Game *game) { this->game = game; sf::Vector2f pos = sf::Vector2f(game->window.getSize()); guiView.setSize(pos); gameView.setSize(pos); pos *= 0.5f; guiView.setCenter(pos); ...
akondas/mockcity
src/audiomanager.hpp
#ifndef AUDIO_MANAGER_HPP #define AUDIO_MANAGER_HPP #include <map> #include <memory> #include <vector> #include <boost/filesystem.hpp> #include <SFML/Audio.hpp> #include "logger.hpp" class AudioManager { public: AudioManager() = default; ~AudioManager() = default; void releaseFinished()...
akondas/mockcity
src/tile.hpp
<gh_stars>1-10 #ifndef TILE_HPP #define TILE_HPP #include <cstdint> #include <SFML/Graphics.hpp> #include <vector> #include "animation_handler.hpp" enum class TileType { VOID, GRASS, FOREST, WATER, RESIDENTIAL, COMMERCIAL, INDUSTRIAL, ROAD }; std::string tileTypeToStr(TileType type);...
akondas/mockcity
src/main.cpp
<reponame>akondas/mockcity #include "game.hpp" #include "game_state_start.hpp" int main() { Game game; game.pushState(new GameStateStart(&game)); game.run(); return 0; }
akondas/mockcity
src/texture_manager.cpp
#include <SFML/Graphics.hpp> #include <map> #include <string> #include "texture_manager.hpp" void TextureManager::load() { loadTexture("background", "media/gfx/background.png"); loadTexture("grass", "media/gfx/grass.png"); loadTexture("forest", "media/gfx/forest.png"); loadTexture("water",...
akondas/mockcity
src/animation_handler.cpp
#include <SFML/Graphics.hpp> #include <vector> #include "animation_handler.hpp" void AnimationHandler::update(const float dt) { if (currentAnim >= this->animations.size() || currentAnim < 0) return; float duration = this->animations[currentAnim].duration; if (int((time + dt) / duration) > int(time / dur...
akondas/mockcity
src/inmemoryfile.cpp
<filename>src/inmemoryfile.cpp #include "inmemoryfile.hpp" InMemoryFile::InMemoryFile(const std::string &path) { load(path); } bool InMemoryFile::load(const std::string &path) { if (data.size() != 0) { this->path = ""; data.clear(); position = 0; } std::ifstream handle{path, s...
akondas/mockcity
src/audiomanager.cpp
#include "audiomanager.hpp" void AudioManager::releaseFinished() { auto it = sounds.begin(); while (it != sounds.end()) { auto &sound = *it; if (!sound->getLoop() && sound->getStatus() == sf::Sound::Stopped) { it = sounds.erase(it); } else { ++it; } }...
akondas/mockcity
src/texture_manager.hpp
<reponame>akondas/mockcity<filename>src/texture_manager.hpp #ifndef TEXTURE_MANAGER_HPP #define TEXTURE_MANAGER_HPP #include <map> #include <string> #include <SFML/Graphics.hpp> class TextureManager { public: TextureManager() = default; void load(); sf::Texture &getRef(const std::strin...
akondas/mockcity
src/inmemoryfile.hpp
#ifndef INMEMORYFILE #define INMEMORYFILE #include <cstdint> #include <fstream> #include <iterator> #include <vector> class InMemoryFile { public: InMemoryFile() = default; InMemoryFile(const std::string &path); ~InMemoryFile() = default; bool load(const std::string &path); ...
akondas/mockcity
src/logger.cpp
<gh_stars>1-10 #include "logger.hpp" std::unique_ptr<Logger> g_logger = std::make_unique<Logger>(); void Logger::log(const LogLevel &level, const char *format, ...) { #ifdef NDEBUG if (level == LogLevel::Debug) { return; } #endif std::stringstream ss; ss << "["; if (level == LogLe...
akondas/mockcity
src/animation_handler.hpp
#ifndef ANIMATION_HANDLER_HPP #define ANIMATION_HANDLER_HPP #include <SFML/Graphics.hpp> #include <vector> class Animation { public: unsigned int startFrame; unsigned int endFrame; float duration; Animation(unsigned int startFrame, unsigned int endFrame, float duration) { this->startFrame =...
kongaskristjan/fire-hpp
include/fire-hpp/fire.hpp
<reponame>kongaskristjan/fire-hpp<filename>include/fire-hpp/fire.hpp<gh_stars>100-1000 /* Copyright <NAME> 2020 Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying docume...
kaidokert/old-esteid-stack
src/utility/pkcs11module.cpp
<gh_stars>0 /*! \file pkcs11module.cpp \copyright (c) <NAME> ( <EMAIL> ) \licence BSD \author $Author$ \date $Date$ */ // Revision $Revision$ #include "precompiled.h" #include "pkcs11module.h" pkcs11module::pkcs11module(const char *n) : DynamicLibrary(n) { pGetFunctionList = (ULONG (*)(void * pInitArgs)) get...
kaidokert/old-esteid-stack
src/tests/testpindialog.cpp
#include "precompiled.h" #include "utility/pinDialog.h" #include <iostream> #ifdef _WIN32 #include <windows.h> int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow ) { struct { HINSTANCE m_hInst; WORD m_resourceID; } params = { hInstance, IDD_PIN_DIALOG_E...
kaidokert/old-esteid-stack
src/windows/esteidcsp/CSPTypes.cpp
<filename>src/windows/esteidcsp/CSPTypes.cpp<gh_stars>0 /*! \file CspTypes.cpp \copyright (c) <NAME> ( <EMAIL> ) \licence BSD \author $Author$ \date $Date$ */ // Revision $Revision$ #include "precompiled.h" #include "CSPTypes.h" #include "CSPErrors.h" #include <algorithm> CSPContext::CSPContext(logger &lo...
kaidokert/old-esteid-stack
src/esteidutil/PinDialog.cpp
<reponame>kaidokert/old-esteid-stack /*! \file PinDialog.cpp \copyright (c) <NAME> ( <EMAIL> ) \licence BSD \author $Author$ \date $Date$ */ // Revision $Revision$ #include "precompiled.h" #include "PinDialog.h" #ifndef __WXMSW__ #include "resources/auth_icon.xpm" #endif BEGIN_EVENT_TABLE(PinDialog, wxDia...
kaidokert/old-esteid-stack
src/tests/testcert.cpp
#include "precompiled.h" #include <iostream> #include <fstream> #include <vector> #include <exception> #include "utility/asnCertificate.h" using std::ios; using std::endl; int err(const char *e) { std::cout << e << endl; return 1; } int main(int argc,char **argv) { if (argc < 2) return err("cert fi...
kaidokert/old-esteid-stack
src/windows/esteidcsp/precompiled.cpp
#include "precompiled.h"
kaidokert/old-esteid-stack
smartcard++/CTAPIManager.cpp
<reponame>kaidokert/old-esteid-stack /*! \file CTAPIManager.cpp \copyright (c) <NAME> ( <EMAIL> ) \licence BSD \author $Author$ \date $Date$ */ // Revision $Revision$ #include "precompiled.h" #include <smartcard++/CTAPIManager.h> #include <smartcard++/helperMacro.h> #include <smartcard++/SCError.h> //for except...