重新组织了项目结构
parent
6555e4db72
commit
d7329e78e6
|
@ -95,27 +95,28 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BvhTree.cpp" />
|
||||
<ClCompile Include="Camera.cpp" />
|
||||
<ClCompile Include="CubicBezier.cpp" />
|
||||
<ClCompile Include="Light.cpp" />
|
||||
<ClCompile Include="Line.cpp" />
|
||||
<ClCompile Include="Mesh.cpp" />
|
||||
<ClCompile Include="Model.cpp" />
|
||||
<ClCompile Include="PaintingHelper.cpp" />
|
||||
<ClCompile Include="PaintingMesh.cpp" />
|
||||
<ClCompile Include="RendererWidget.cpp" />
|
||||
<ClCompile Include="ShortCutTree.cpp" />
|
||||
<ClCompile Include="StraightLine.cpp" />
|
||||
<ClCompile Include="SvgParser.cpp" />
|
||||
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\MainWindow.cpp" />
|
||||
<ClCompile Include="src\Renderer\BvhTree.cpp" />
|
||||
<ClCompile Include="src\Renderer\Camera.cpp" />
|
||||
<ClCompile Include="src\Renderer\CubicBezier.cpp" />
|
||||
<ClCompile Include="src\Renderer\CubicMonotonization.cpp" />
|
||||
<ClCompile Include="src\Renderer\Light.cpp" />
|
||||
<ClCompile Include="src\Renderer\Line.cpp" />
|
||||
<ClCompile Include="src\Renderer\Mesh.cpp" />
|
||||
<ClCompile Include="src\Renderer\Model.cpp" />
|
||||
<ClCompile Include="src\Renderer\PaintingHelper.cpp" />
|
||||
<ClCompile Include="src\Renderer\PaintingMesh.cpp" />
|
||||
<ClCompile Include="src\Renderer\RendererGLWidget.cpp" />
|
||||
<ClCompile Include="src\Renderer\RendererWidget.cpp" />
|
||||
<ClCompile Include="src\Renderer\ShortCutTree.cpp" />
|
||||
<ClCompile Include="src\Renderer\StraightLine.cpp" />
|
||||
<ClCompile Include="src\SvgParser.cpp" />
|
||||
<QtRcc Include="MainWindow.qrc" />
|
||||
<QtUic Include="EditorWidget.ui" />
|
||||
<QtUic Include="MainWindow.ui" />
|
||||
<QtMoc Include="MainWindow.h" />
|
||||
<ClCompile Include="MainWindow.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="RendererWidget.h" />
|
||||
<QtUic Include="RendererWidget.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Shaders\depth_init.comp" />
|
||||
|
@ -136,19 +137,24 @@
|
|||
<None Include="Shaders\ssgi.comp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="BvhTree.h" />
|
||||
<ClInclude Include="Camera.h" />
|
||||
<ClInclude Include="CubicBezier.h" />
|
||||
<ClInclude Include="Drawable.h" />
|
||||
<ClInclude Include="Light.h" />
|
||||
<ClInclude Include="Line.h" />
|
||||
<ClInclude Include="Mesh.h" />
|
||||
<ClInclude Include="Model.h" />
|
||||
<ClInclude Include="PaintingHelper.h" />
|
||||
<ClInclude Include="PaintingMesh.h" />
|
||||
<ClInclude Include="ShortCutTree.h" />
|
||||
<ClInclude Include="StraightLine.h" />
|
||||
<ClInclude Include="SvgParser.h" />
|
||||
<QtMoc Include="src\Renderer\RendererWidget.h" />
|
||||
<ClInclude Include="src\SvgParser.h" />
|
||||
<QtMoc Include="src\MainWindow.h" />
|
||||
<QtMoc Include="src\Editor\EditorWidget.h" />
|
||||
<ClInclude Include="src\Renderer\BvhTree.h" />
|
||||
<ClInclude Include="src\Renderer\Camera.h" />
|
||||
<ClInclude Include="src\Renderer\CubicBezier.h" />
|
||||
<ClInclude Include="src\Renderer\CubicMonotonization.h" />
|
||||
<ClInclude Include="src\Renderer\Drawable.h" />
|
||||
<ClInclude Include="src\Renderer\Light.h" />
|
||||
<ClInclude Include="src\Renderer\Line.h" />
|
||||
<ClInclude Include="src\Renderer\Mesh.h" />
|
||||
<ClInclude Include="src\Renderer\Model.h" />
|
||||
<ClInclude Include="src\Renderer\PaintingHelper.h" />
|
||||
<ClInclude Include="src\Renderer\PaintingMesh.h" />
|
||||
<ClInclude Include="src\Renderer\ShortCutTree.h" />
|
||||
<ClInclude Include="src\Renderer\StraightLine.h" />
|
||||
<QtMoc Include="src\Renderer\RendererGLWidget.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
|
|
|
@ -24,6 +24,18 @@
|
|||
<Filter Include="Resource Files\Shaders">
|
||||
<UniqueIdentifier>{60515177-3da7-420f-8f5b-27c16bb2b77b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Editor">
|
||||
<UniqueIdentifier>{bd91d673-6674-478d-a43d-54ac6c09d77f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Editor">
|
||||
<UniqueIdentifier>{f21af5cf-2eba-4e89-a7ca-faebd689025d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Renderer">
|
||||
<UniqueIdentifier>{f1a582fa-33b1-46fe-b969-e1b2de56bf7e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Renderer">
|
||||
<UniqueIdentifier>{f52671e3-3263-45e6-8d6c-976d19dc7e24}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="MainWindow.qrc">
|
||||
|
@ -32,60 +44,75 @@
|
|||
<QtUic Include="MainWindow.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtMoc Include="MainWindow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Editor\EditorWidget.cpp">
|
||||
<Filter>Source Files\Editor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\BvhTree.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\Camera.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\CubicBezier.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\CubicMonotonization.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\Light.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\Line.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\Mesh.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\Model.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\PaintingHelper.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\PaintingMesh.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\RendererGLWidget.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\ShortCutTree.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\StraightLine.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\MainWindow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SvgParser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Renderer\RendererWidget.cpp">
|
||||
<Filter>Source Files\Renderer</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="src\Renderer\RendererGLWidget.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</QtMoc>
|
||||
<ClCompile Include="MainWindow.cpp">
|
||||
<QtMoc Include="src\Editor\EditorWidget.h">
|
||||
<Filter>Header Files\Editor</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="src\MainWindow.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RendererWidget.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Camera.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mesh.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Model.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PaintingMesh.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BvhTree.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PaintingHelper.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Light.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShortCutTree.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Line.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CubicBezier.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StraightLine.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SvgParser.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="RendererWidget.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="src\Renderer\RendererWidget.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -139,44 +166,55 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Camera.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<QtUic Include="EditorWidget.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="RendererWidget.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\Renderer\BvhTree.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Camera.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Model.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\CubicBezier.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PaintingMesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\CubicMonotonization.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Drawable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Drawable.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BvhTree.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Light.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PaintingHelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Line.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Light.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Mesh.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShortCutTree.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\Model.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Line.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\PaintingHelper.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CubicBezier.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\PaintingMesh.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StraightLine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\ShortCutTree.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SvgParser.h">
|
||||
<Filter>Header Files</Filter>
|
||||
<ClInclude Include="src\Renderer\StraightLine.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\SvgParser.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditorWidgetClass</class>
|
||||
<widget class="QWidget" name="EditorWidgetClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<height>695</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>RendererWidget</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>纹理编辑</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,16 +0,0 @@
|
|||
#include "MainWindow.h"
|
||||
#include "RendererWidget.h"
|
||||
#include "qslider.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererWidget::setMainLightPitch);
|
||||
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererWidget::setMainLightYaw);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{}
|
|
@ -34,61 +34,55 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="RendererWidget" name="openGLWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Microsoft YaHei UI</family>
|
||||
<pointsize>13</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="EditorWidget" name="editorWidget">
|
||||
<attribute name="title">
|
||||
<string>纹理编辑</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="RendererWidget" name="rendererWidget">
|
||||
<attribute name="title">
|
||||
<string>场景渲染</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider_2">
|
||||
<property name="maximum">
|
||||
<number>360</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RendererWidget</class>
|
||||
<extends>QOpenGLWidget</extends>
|
||||
<header>RendererWidget.h</header>
|
||||
<extends>QWidget</extends>
|
||||
<header>Renderer/RendererWidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>EditorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>Editor/EditorWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RendererWidgetClass</class>
|
||||
<widget class="QWidget" name="RendererWidgetClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1124</width>
|
||||
<height>695</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>RendererWidget</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="RendererGLWidget" name="openGLWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>180</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider_2">
|
||||
<property name="maximum">
|
||||
<number>360</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>RendererGLWidget</class>
|
||||
<extends>QOpenGLWidget</extends>
|
||||
<header>RendererGLWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,10 @@
|
|||
#include "EditorWidget.h"
|
||||
|
||||
EditorWidget::EditorWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
EditorWidget::~EditorWidget()
|
||||
{}
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_EditorWidget.h"
|
||||
|
||||
class EditorWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorWidget(QWidget *parent = nullptr);
|
||||
~EditorWidget();
|
||||
|
||||
private:
|
||||
Ui::EditorWidgetClass ui;
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
#include "MainWindow.h"
|
||||
#include "Renderer/RendererGLWidget.h"
|
||||
#include "qslider.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{}
|
|
@ -8,7 +8,7 @@
|
|||
#include <QtMath>
|
||||
#include "BvhTree.h"
|
||||
#include "ShortCutTree.h"
|
||||
#include "SvgParser.h"
|
||||
#include "../SvgParser.h"
|
||||
|
||||
Model::Model(QString path, QOpenGLContext* context, QOpenGLShaderProgram* shaderProgram)
|
||||
: context(context)
|
|
@ -1,4 +1,4 @@
|
|||
#include "RendererWidget.h"
|
||||
#include "RendererGLWidget.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
@ -12,7 +12,7 @@ QVector3D lightColors[] = { 20 * QVector3D(0.7529,0.7450,0.6784).normalized(), Q
|
|||
static float sunPitch = 105, sunYaw = 80;
|
||||
static int sunSpeed = 10;
|
||||
|
||||
RendererWidget::RendererWidget(QWidget* parent)
|
||||
RendererGLWidget::RendererGLWidget(QWidget* parent)
|
||||
: QOpenGLWidget(parent)
|
||||
, camera(QVector3D(0.0f, 100.0f, 0.0f))
|
||||
, light(&camera)
|
||||
|
@ -26,7 +26,7 @@ RendererWidget::RendererWidget(QWidget* parent)
|
|||
setFormat(format);
|
||||
}
|
||||
|
||||
RendererWidget::~RendererWidget()
|
||||
RendererGLWidget::~RendererGLWidget()
|
||||
{
|
||||
if (modelProgramPtr != nullptr)
|
||||
{
|
||||
|
@ -51,19 +51,19 @@ RendererWidget::~RendererWidget()
|
|||
}
|
||||
}
|
||||
|
||||
void RendererWidget::setMainLightPitch(float pitch)
|
||||
void RendererGLWidget::setMainLightPitch(float pitch)
|
||||
{
|
||||
//qDebug() << "pitch" << pitch;
|
||||
sunPitch = pitch;
|
||||
}
|
||||
|
||||
void RendererWidget::setMainLightYaw(float yaw)
|
||||
void RendererGLWidget::setMainLightYaw(float yaw)
|
||||
{
|
||||
//qDebug() << "yaw" << yaw;
|
||||
sunYaw = yaw;
|
||||
}
|
||||
QOpenGLTexture randomMap(QOpenGLTexture::Target2D);
|
||||
void RendererWidget::initializeGL()
|
||||
void RendererGLWidget::initializeGL()
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
qDebug() << "GL_VERSION" << (char*)glGetString(GL_VERSION);
|
||||
|
@ -243,7 +243,7 @@ void RendererWidget::initializeGL()
|
|||
|
||||
}
|
||||
|
||||
void RendererWidget::paintGL()
|
||||
void RendererGLWidget::paintGL()
|
||||
{
|
||||
light.lightDirection.setX(cos(qDegreesToRadians(sunPitch)) * cos(qDegreesToRadians(sunYaw)));
|
||||
light.lightDirection.setY(sin(qDegreesToRadians(sunPitch)));
|
||||
|
@ -391,7 +391,7 @@ void RendererWidget::paintGL()
|
|||
finalProgramPtr->release();
|
||||
}
|
||||
|
||||
void RendererWidget::resizeGL(int width, int height)
|
||||
void RendererGLWidget::resizeGL(int width, int height)
|
||||
{
|
||||
frameWidth = ceil( devicePixelRatioF() * width);
|
||||
frameHeight = ceil(devicePixelRatioF() * height);
|
||||
|
@ -531,7 +531,7 @@ void RendererWidget::resizeGL(int width, int height)
|
|||
std::cout << "\033[?25l";
|
||||
}
|
||||
|
||||
void RendererWidget::timerEvent(QTimerEvent* event)
|
||||
void RendererGLWidget::timerEvent(QTimerEvent* event)
|
||||
{
|
||||
clock_t currentFrame = std::clock();
|
||||
deltaTime = (float)(currentFrame - lastFrame) / CLOCKS_PER_SEC;
|
||||
|
@ -589,7 +589,7 @@ void RendererWidget::timerEvent(QTimerEvent* event)
|
|||
repaint();
|
||||
}
|
||||
|
||||
void RendererWidget::keyPressEvent(QKeyEvent* event)
|
||||
void RendererGLWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
clearFocus();
|
||||
|
@ -598,25 +598,25 @@ void RendererWidget::keyPressEvent(QKeyEvent* event)
|
|||
QOpenGLWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void RendererWidget::keyReleaseEvent(QKeyEvent* event)
|
||||
void RendererGLWidget::keyReleaseEvent(QKeyEvent* event)
|
||||
{
|
||||
if (!event->isAutoRepeat())
|
||||
pressedKeys.remove(event->key());
|
||||
QOpenGLWidget::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void RendererWidget::wheelEvent(QWheelEvent* event)
|
||||
void RendererGLWidget::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
camera.ProcessMouseScroll(event->delta() / 15.);
|
||||
}
|
||||
|
||||
void RendererWidget::focusInEvent(QFocusEvent* event)
|
||||
void RendererGLWidget::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
setCursor(Qt::BlankCursor);
|
||||
cursor().setPos(mapToGlobal(geometry().center()));
|
||||
}
|
||||
|
||||
void RendererWidget::focusOutEvent(QFocusEvent* event)
|
||||
void RendererGLWidget::focusOutEvent(QFocusEvent* event)
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
|
@ -12,12 +12,12 @@
|
|||
#include "Model.h"
|
||||
#include "PaintingHelper.h"
|
||||
|
||||
class RendererWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_5_Compatibility
|
||||
class RendererGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_5_Compatibility
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RendererWidget(QWidget* parent = nullptr);
|
||||
~RendererWidget();
|
||||
RendererGLWidget(QWidget* parent = nullptr);
|
||||
~RendererGLWidget();
|
||||
|
||||
public slots:
|
||||
void setMainLightPitch(float pitch);
|
|
@ -0,0 +1,15 @@
|
|||
#include "RendererWidget.h"
|
||||
#include "RendererGLWidget.h"
|
||||
|
||||
RendererWidget::RendererWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererGLWidget::setMainLightPitch);
|
||||
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererGLWidget::setMainLightYaw);
|
||||
}
|
||||
|
||||
RendererWidget::~RendererWidget()
|
||||
{}
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_RendererWidget.h"
|
||||
|
||||
class RendererWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RendererWidget(QWidget *parent = nullptr);
|
||||
~RendererWidget();
|
||||
|
||||
private:
|
||||
Ui::RendererWidgetClass ui;
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Line.h"
|
||||
#include "Renderer/Line.h"
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
using namespace std;
|
Loading…
Reference in New Issue