├── .gitignore
├── EWA过滤函数.gsp
├── ImageCache
├── airBrushPart1.gif
├── airBrushPart2.gif
├── chalk.gif
├── eraser.gif
├── floor.gif
├── mud.gif
├── stamp.gif
├── switch.gif
├── toiletPart1.gif
├── toiletPart2.gif
├── tubePart1.gif
└── tubePart2.gif
├── Ptex过滤函数.gsp
├── README.md
├── shaderProject
├── Blinn_bump_reflect.fx
├── Document1.dae
├── Project1.fxcproj
└── sceneShader.rfx
├── vsProject
├── ClassDiagram1.png
├── Debug
│ ├── BuildLog.htm
│ └── IconResource.res
├── Paint3DSetup
│ └── Paint3DSetup.vdproj
├── paint3D.sln
├── paint3D
│ ├── 1.mtl
│ ├── 2.mtl
│ ├── 3.mtl
│ ├── BlendCurveGraphWidget.cpp
│ ├── BlendCurveGraphWidget.h
│ ├── BoundingBox.cpp
│ ├── BoundingBox.h
│ ├── Brush.cpp
│ ├── Brush.h
│ ├── BrushSettingWidget.cpp
│ ├── BrushSettingWidget.h
│ ├── Camera.cpp
│ ├── Camera.h
│ ├── Canvas.cpp
│ ├── Canvas.h
│ ├── CanvasSeamFiller.cpp
│ ├── CanvasSeamFiller.h
│ ├── ClassDiagram1.cd
│ ├── ColorSelectButton.cpp
│ ├── ColorSelectButton.h
│ ├── CubeMap.cpp
│ ├── CubeMap.h
│ ├── GLContext.cpp
│ ├── GLContext.h
│ ├── GLScene.cpp
│ ├── GLScene.h
│ ├── GLViewWidget.cpp
│ ├── GLViewWidget.h
│ ├── GeometryExposer.cpp
│ ├── GeometryExposer.h
│ ├── HistoryCommand.cpp
│ ├── HistoryCommand.h
│ ├── HistoryWidget.cpp
│ ├── HistoryWidget.h
│ ├── IconResource.rc
│ ├── Manipulator.cpp
│ ├── Manipulator.h
│ ├── MaterialLayerWidget.cpp
│ ├── MaterialLayerWidget.h
│ ├── Mesh.cpp
│ ├── Mesh.h
│ ├── ObjReader.cpp
│ ├── ObjReader.h
│ ├── ObjectTransformWidget.cpp
│ ├── ObjectTransformWidget.h
│ ├── Paint3DFrame.cpp
│ ├── Paint3DFrame.h
│ ├── Paint3DShaders.rfx
│ ├── PaintPicker.cpp
│ ├── PaintPicker.h
│ ├── PaintSettingWidget.cpp
│ ├── PaintSettingWidget.h
│ ├── Painter.cpp
│ ├── Painter.h
│ ├── RenderableObject.cpp
│ ├── RenderableObject.h
│ ├── Resources
│ │ ├── arrow.png
│ │ ├── brush.png
│ │ ├── copy.png
│ │ ├── cut.png
│ │ ├── fileIcon.png
│ │ ├── focus.png
│ │ ├── import.png
│ │ ├── minus.png
│ │ ├── move.png
│ │ ├── move.psd
│ │ ├── new.png
│ │ ├── null.png
│ │ ├── open.png
│ │ ├── paint.png
│ │ ├── paste.png
│ │ ├── planeLocator .png
│ │ ├── plus.png
│ │ ├── redo.png
│ │ ├── rotate.png
│ │ ├── save.png
│ │ ├── scale.png
│ │ ├── select.png
│ │ ├── selectFace.png
│ │ ├── selectFace.psd
│ │ ├── software.png
│ │ ├── software_1337421205.ico
│ │ └── undo.png
│ ├── RotateManipulator.cpp
│ ├── RotateManipulator.h
│ ├── ScaleManipulator.cpp
│ ├── ScaleManipulator.h
│ ├── Scene.cpp
│ ├── Scene.h
│ ├── Stroke.cpp
│ ├── Stroke.h
│ ├── TranslateManipulator.cpp
│ ├── TranslateManipulator.h
│ ├── Triangle.cpp
│ ├── Triangle.h
│ ├── aboutDlg.ui
│ ├── background.jpg
│ ├── background.png
│ ├── background_0.jpg
│ ├── background_1.jpg
│ ├── background_2.jpg
│ ├── background_3.jpg
│ ├── background_4.jpg
│ ├── background_5.jpg
│ ├── backup.png
│ ├── bombom.p3d
│ ├── brushSetting.ui
│ ├── chalk.p3d
│ ├── curLayer.png
│ ├── expPlane.mtl
│ ├── fboShaderFS.glsl
│ ├── fboShaderVS.glsl
│ ├── glew-2.1.0
│ │ ├── include
│ │ │ └── GL
│ │ │ │ ├── eglew.h
│ │ │ │ ├── glew.h
│ │ │ │ ├── glxew.h
│ │ │ │ └── wglew.h
│ │ └── lib
│ │ │ └── Release
│ │ │ ├── Win32
│ │ │ ├── glew32.lib
│ │ │ └── glew32s.lib
│ │ │ └── x64
│ │ │ ├── glew32.lib
│ │ │ └── glew32s.lib
│ ├── glew32.dll
│ ├── glextensions.cpp
│ ├── glextensions.h
│ ├── history.ui
│ ├── knot.mtl
│ ├── knot.p3d
│ ├── knotNew.p3d
│ ├── knotNew2.p3d
│ ├── main.cpp
│ ├── mainWindow.ui
│ ├── materialLayer.ui
│ ├── mountain.mtl
│ ├── myapp.ico
│ ├── object.ui
│ ├── paint3D.vcproj
│ ├── paint3D.vcxproj
│ ├── paint3D.vcxproj.filters
│ ├── paint3d.qrc
│ ├── paint3d_zh.qm
│ ├── paint3d_zh.ts
│ ├── paintSetting.ui
│ ├── plane.mtl
│ ├── sceneShaderFS.glsl
│ ├── sceneShaderVS.glsl
│ ├── sliderspinnergroup.cpp
│ ├── sliderspinnergroup.h
│ ├── sphere.mtl
│ ├── stdafx.cpp
│ ├── stdafx.h
│ ├── teapot.mtl
│ ├── teapots.mtl
│ ├── test.p3d
│ ├── test2.p3d
│ ├── toilet.mtl
│ ├── toilet.p3d
│ ├── toiletNew.p3d
│ ├── triangleMask.png
│ ├── woodTable.p3d
│ ├── 复件 CanvasSeamFiller.cpp
│ ├── 方头画笔.abr
│ └── 自然画笔 2.abr
├── readme.txt
├── template.png
└── 详细说明.docx
├── 双线性插值.gsp
└── 四边形插值.gsp
/.gitignore:
--------------------------------------------------------------------------------
1 | vsProject/CodeGraphData/
2 | vsProject/Debug/
3 | vsProject/Release/
4 | vsProject/_UpgradeReport_Files/
5 | vsProject/ipch/
6 | vsProject/paint3D/GeneratedFiles/
7 | *.htm
8 |
--------------------------------------------------------------------------------
/EWA过滤函数.gsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/EWA过滤函数.gsp
--------------------------------------------------------------------------------
/ImageCache/airBrushPart1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/airBrushPart1.gif
--------------------------------------------------------------------------------
/ImageCache/airBrushPart2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/airBrushPart2.gif
--------------------------------------------------------------------------------
/ImageCache/chalk.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/chalk.gif
--------------------------------------------------------------------------------
/ImageCache/eraser.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/eraser.gif
--------------------------------------------------------------------------------
/ImageCache/floor.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/floor.gif
--------------------------------------------------------------------------------
/ImageCache/mud.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/mud.gif
--------------------------------------------------------------------------------
/ImageCache/stamp.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/stamp.gif
--------------------------------------------------------------------------------
/ImageCache/switch.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/switch.gif
--------------------------------------------------------------------------------
/ImageCache/toiletPart1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/toiletPart1.gif
--------------------------------------------------------------------------------
/ImageCache/toiletPart2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/toiletPart2.gif
--------------------------------------------------------------------------------
/ImageCache/tubePart1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/tubePart1.gif
--------------------------------------------------------------------------------
/ImageCache/tubePart2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/ImageCache/tubePart2.gif
--------------------------------------------------------------------------------
/Ptex过滤函数.gsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/Ptex过滤函数.gsp
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Paint3D
2 | A program allowing painting textures of different channels SIMULTANEOUSLY on a 3d model.
3 | You can also see this page: https://www.cnblogs.com/dydx/p/6446298.html
4 |
5 | ### Preliminary
6 | Qt 5.3 32bit
7 | OpenGL 32bit
8 | Visual Studio 2012
9 |
10 | ### Screenshots
11 |
12 | 
13 |
14 | 
15 |
16 | 
17 |
18 | 
19 |
20 | 
21 |
22 | 
23 |
24 | 
25 |
26 | 
27 |
28 | 
29 |
30 | 
31 |
32 | 
33 |
34 | 
35 |
--------------------------------------------------------------------------------
/shaderProject/Blinn_bump_reflect.fx:
--------------------------------------------------------------------------------
1 | /*********************************************************************NVMH3****
2 | $Revision$
3 |
4 | Copyright NVIDIA Corporation 2007
5 | TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
6 | *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
7 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
8 | AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
9 | BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
10 | WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
11 | BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
12 | LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
13 | NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
14 |
15 |
16 | To learn more about shading, shaders, and to bounce ideas off other shader
17 | authors and users, visit the NVIDIA Shader Library Forums at:
18 |
19 | http://developer.nvidia.com/forums/
20 |
21 | ******************************************************************************/
22 |
23 | #define FLIP_TEXTURE_Y
24 |
25 | float Script : STANDARDSGLOBAL <
26 | string UIWidget = "none";
27 | string ScriptClass = "object";
28 | string ScriptOrder = "standard";
29 | string ScriptOutput = "color";
30 | string Script = "Technique=BlinnBump?Main:Main10;";
31 | > = 0.8;
32 |
33 | //// UN-TWEAKABLES - AUTOMATICALLY-TRACKED TRANSFORMS ////////////////
34 |
35 | float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
36 | float4x4 WvpXf : WorldViewProjection < string UIWidget="None"; >;
37 | float4x4 WorldXf : World < string UIWidget="None"; >;
38 | float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >;
39 |
40 | //// TWEAKABLE PARAMETERS ////////////////////
41 |
42 | /// Point Lamp 0 ////////////
43 | float3 Lamp0Pos : Position <
44 | string Object = "PointLight0";
45 | string UIName = "Lamp 0 Position";
46 | string Space = "World";
47 | > = {-0.5f,2.0f,1.25f};
48 | float3 Lamp0Color : Specular <
49 | string UIName = "Lamp 0";
50 | string Object = "Pointlight0";
51 | string UIWidget = "Color";
52 | > = {1.0f,1.0f,1.0f};
53 |
54 | // Ambient Light
55 | float3 AmbiColor : Ambient <
56 | string UIName = "Ambient Light";
57 | string UIWidget = "Color";
58 | > = {0.07f,0.07f,0.07f};
59 |
60 | float Ks <
61 | string UIWidget = "slider";
62 | float UIMin = 0.0;
63 | float UIMax = 1.0;
64 | float UIStep = 0.05;
65 | string UIName = "Specular";
66 | > = 0.4;
67 |
68 | float Eccentricity <
69 | string UIWidget = "slider";
70 | float UIMin = 0.0;
71 | float UIMax = 1.0;
72 | float UIStep = 0.0001;
73 | string UIName = "Highlight Eccentricity";
74 | > = 0.3;
75 |
76 | float fresnelN <
77 | string UIWidget = "slider";
78 | float UIMin = 1;
79 | float UIMax = 3;
80 | float UIStep = 0.01;
81 | string UIName = "fresnel N";
82 | > = 0.3;
83 |
84 | float fresnelK <
85 | string UIWidget = "slider";
86 | float UIMin = 0;
87 | float UIMax = 10.0;
88 | float UIStep = 0.01;
89 | string UIName = "fresnel K";
90 | > = 0.3;
91 |
92 |
93 | float blurry <
94 | string UIWidget = "slider";
95 | float UIMin = 0;
96 | float UIMax = 9;
97 | float UIStep = 0.1;
98 | string UIName = "Blurry";
99 | > = 0.3;
100 |
101 | float Bump <
102 | string UIWidget = "slider";
103 | float UIMin = 0.0;
104 | float UIMax = 3.0;
105 | float UIStep = 0.01;
106 | string UIName = "Bumpiness";
107 | > = 1.0;
108 |
109 | float Kr <
110 | string UIWidget = "slider";
111 | float UIMin = 0.0;
112 | float UIMax = 2.0;
113 | float UIStep = 0.01;
114 | string UIName = "Reflection Strength";
115 | > = 0.5;
116 |
117 | //////// COLOR & TEXTURE /////////////////////
118 |
119 | texture ColorTexture : DIFFUSE <
120 | string ResourceName = "default_color.dds";
121 | string UIName = "Diffuse Texture";
122 | string ResourceType = "2D";
123 | >;
124 |
125 | sampler2D ColorSampler = sampler_state {
126 | Texture = ;
127 | FILTER = MIN_MAG_MIP_LINEAR;
128 | AddressU = Wrap;
129 | AddressV = Wrap;
130 | };
131 |
132 | texture NormalTexture <
133 | string ResourceName = "default_bump_normal.dds";
134 | string UIName = "Normal-Map Texture";
135 | string ResourceType = "2D";
136 | >;
137 |
138 | sampler2D NormalSampler = sampler_state {
139 | Texture = ;
140 | FILTER = MIN_MAG_MIP_LINEAR;
141 | AddressU = Wrap;
142 | AddressV = Wrap;
143 | };
144 |
145 | texture EnvTexture : ENVIRONMENT <
146 | string ResourceName = "default_reflection.dds";
147 | string UIName = "Environment";
148 | string ResourceType = "Cube";
149 | >;
150 |
151 | samplerCUBE EnvSampler = sampler_state {
152 | Texture = ;
153 | FILTER = MIN_MAG_MIP_LINEAR;
154 | AddressU = Clamp;
155 | AddressV = Clamp;
156 | AddressW = Clamp;
157 | };
158 |
159 | // shared shadow mapping supported in Cg version
160 |
161 | //////// CONNECTOR DATA STRUCTURES ///////////
162 |
163 | /* data from application vertex buffer */
164 | struct appdata {
165 | float3 Position : POSITION;
166 | float4 UV : TEXCOORD0;
167 | float4 Normal : NORMAL;
168 | float4 Tangent : TANGENT0;
169 | float4 Binormal : BINORMAL0;
170 | };
171 |
172 | /* data passed from vertex shader to pixel shader */
173 | struct vertexOutput {
174 | float4 HPosition : POSITION;
175 | float2 UV : TEXCOORD0;
176 | // The following values are passed in "World" coordinates since
177 | // it tends to be the most flexible and easy for handling
178 | // reflections, sky lighting, and other "global" effects.
179 | float3 LightVec : TEXCOORD1;
180 | float3 WorldNormal : TEXCOORD2;
181 | float3 WorldTangent : TEXCOORD3;
182 | float3 WorldBinormal : TEXCOORD4;
183 | float3 WorldView : TEXCOORD5;
184 | };
185 |
186 | ///////// VERTEX SHADING /////////////////////
187 |
188 | /*********** Generic Vertex Shader ******/
189 |
190 | vertexOutput std_VS(appdata IN) {
191 | vertexOutput OUT = (vertexOutput)0;
192 | OUT.WorldNormal = mul(IN.Normal,WorldITXf).xyz;
193 | OUT.WorldTangent = mul(IN.Tangent,WorldITXf).xyz;
194 | OUT.WorldBinormal = mul(IN.Binormal,WorldITXf).xyz;
195 | float4 Po = float4(IN.Position.xyz,1);
196 | float3 Pw = mul(Po,WorldXf).xyz;
197 | OUT.LightVec = (Lamp0Pos - Pw);
198 | #ifdef FLIP_TEXTURE_Y
199 | OUT.UV = float2(IN.UV.x,(1.0-IN.UV.y));
200 | #else /* !FLIP_TEXTURE_Y */
201 | OUT.UV = IN.UV.xy;
202 | #endif /* !FLIP_TEXTURE_Y */
203 | OUT.WorldView = normalize(ViewIXf[3].xyz - Pw);
204 | OUT.HPosition = mul(Po,WvpXf);
205 | return OUT;
206 | }
207 |
208 | ///////// PIXEL SHADING //////////////////////
209 |
210 | // Utility function for blinn shading
211 |
212 | void blinn_shading(vertexOutput IN,
213 | float3 LightColor,
214 | float3 Nn,
215 | float3 Ln,
216 | float3 Vn,
217 | out float3 DiffuseContrib,
218 | out float3 SpecularContrib)
219 | {
220 | float3 Hn = normalize(Vn + Ln);
221 | float hdn = dot(Hn,Nn);
222 | float3 R = reflect(-Ln,Nn);
223 | float rdv = dot(R,Vn);
224 | rdv = max(rdv,0.001);
225 | float ldn=dot(Ln,Nn);
226 | ldn = max(ldn,0.0);
227 | float ndv = dot(Nn,Vn);
228 | float hdv = dot(Hn,Vn);
229 | float eSq = Eccentricity*Eccentricity;
230 | float distrib = eSq / (rdv * rdv * (eSq - 1.0) + 1.0);
231 | distrib = distrib * distrib;
232 | float Gb = 2.0 * hdn * ndv / hdv;
233 | float Gc = 2.0 * hdn * ldn / hdv;
234 | float Ga = min(1.0,min(Gb,Gc));
235 | float fresnelHack = 1.0 - pow(ndv,5.0);
236 | hdn = distrib * Ga * fresnelHack / ndv;
237 | DiffuseContrib = ldn * LightColor;
238 | SpecularContrib = hdn * Ks * LightColor;
239 | }
240 |
241 | float4 std_PS(vertexOutput IN) : COLOR
242 | {
243 | float3 diffContrib;
244 | float3 specContrib;
245 | float3 Ln = normalize(IN.LightVec);
246 | float3 Vn = normalize(IN.WorldView);
247 | float3 Nn = normalize(IN.WorldNormal);
248 | float3 Tn = normalize(IN.WorldTangent);
249 | float3 Bn = normalize(IN.WorldBinormal);
250 | float3 bump = Bump * (tex2D(NormalSampler,IN.UV).rgb - float3(0.5,0.5,0.5));
251 |
252 | Nn = Nn + bump.x*Tn + bump.y*Bn;
253 | Nn = normalize(Nn);
254 |
255 | blinn_shading(IN,Lamp0Color,Nn,Ln,Vn,diffContrib,specContrib);
256 | float3 diffuseColor = float3(0.8,0.5,0);//tex2D(ColorSampler,IN.UV).rgb;
257 | float3 result = specContrib+(diffuseColor*(diffContrib+AmbiColor));
258 | float3 R = -reflect(Vn,Nn);
259 |
260 | float3 reflColor = Kr * texCUBElod(EnvSampler,float4(R.xyz,blurry)).rgb;
261 | float ndv = dot(Nn, Vn);
262 |
263 | float fresnelN_m1_sq = fresnelN - 1;
264 | fresnelN_m1_sq *= fresnelN_m1_sq;
265 | float fresnel4N = fresnelN * 4;
266 | float fresnelN_a1_sq = fresnelN_m1_sq + fresnel4N;
267 | float fresnelK_sq = fresnelK * fresnelK;
268 | float fresnel = (fresnelN_m1_sq + fresnel4N * pow(1 - ndv,5) + fresnelK_sq) / (fresnelN_a1_sq + fresnelK_sq);
269 | result = result*(1-fresnel) + fresnel*diffuseColor*reflColor;
270 | return float4(result,1);
271 | }
272 |
273 | ///// TECHNIQUES /////////////////////////////
274 | RasterizerState DisableCulling
275 | {
276 | CullMode = NONE;
277 | };
278 |
279 | DepthStencilState DepthEnabling
280 | {
281 | DepthEnable = TRUE;
282 | };
283 |
284 | BlendState DisableBlend
285 | {
286 | BlendEnable[0] = FALSE;
287 | };
288 |
289 | technique10 Main10 <
290 | string Script = "Pass=p0;";
291 | > {
292 | pass p0 <
293 | string Script = "Draw=geometry;";
294 | > {
295 | SetVertexShader( CompileShader( vs_4_0, std_VS() ) );
296 | SetGeometryShader( NULL );
297 | SetPixelShader( CompileShader( ps_4_0, std_PS() ) );
298 |
299 | SetRasterizerState(DisableCulling);
300 | SetDepthStencilState(DepthEnabling, 0);
301 | SetBlendState(DisableBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF);
302 | }
303 | }
304 |
305 | technique Main <
306 | string Script = "Pass=p0;";
307 | > {
308 | pass p0 <
309 | string Script = "Draw=geometry;";
310 | > {
311 | VertexShader = compile vs_2_0 std_VS();
312 | ZEnable = true;
313 | ZWriteEnable = true;
314 | ZFunc = LessEqual;
315 | AlphaBlendEnable = false;
316 | CullMode = None;
317 | PixelShader = compile ps_3_0 std_PS();
318 | }
319 | }
320 |
321 | /////////////////////////////////////// eof //
322 |
--------------------------------------------------------------------------------
/shaderProject/Project1.fxcproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 2.178022
62 | 40
63 | 0 0 1 1
64 | 1 0 0 0 0 5.960464E-08 -0.9999999 0 0 0.9999999 5.960464E-08 0 0.1074073 2.965522 0 1
65 |
66 |
67 | 2.178022
68 | 40
69 | 0 0 1 1
70 | 1 0 0 0 0 1 0 0 0 0 1 0 0.1074073 0.7875 2.178022 1
71 |
72 |
73 | 2.178022
74 | 40
75 | 0 0 1 1
76 | 5.960464E-08 0 -0.9999999 0 0 1 0 0 0.9999999 0 5.960464E-08 0 2.285429 0.7875 0 1
77 |
78 |
79 | 6.34716
80 | 40
81 | 0 0 1 1
82 | 0.4225157 5.819674E-06 0.9063556 0 0.3037723 0.9421612 -0.1416156 0 -0.8539339 0.3351605 0.398076 0 -5.335086 2.871912 2.626916 1
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/vsProject/ClassDiagram1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/ClassDiagram1.png
--------------------------------------------------------------------------------
/vsProject/Debug/BuildLog.htm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/Debug/BuildLog.htm
--------------------------------------------------------------------------------
/vsProject/Debug/IconResource.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/Debug/IconResource.res
--------------------------------------------------------------------------------
/vsProject/paint3D.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "paint3D", "paint3D\paint3D.vcxproj", "{FF9615E1-CE3A-4F98-BC75-EDAD3C42FD9C}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {FF9615E1-CE3A-4F98-BC75-EDAD3C42FD9C}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {FF9615E1-CE3A-4F98-BC75-EDAD3C42FD9C}.Debug|Win32.Build.0 = Debug|Win32
14 | {FF9615E1-CE3A-4F98-BC75-EDAD3C42FD9C}.Release|Win32.ActiveCfg = Release|Win32
15 | {FF9615E1-CE3A-4F98-BC75-EDAD3C42FD9C}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ExtensibilityGlobals) = postSolution
21 | QtVersion = 4.8.4
22 | EndGlobalSection
23 | EndGlobal
24 |
--------------------------------------------------------------------------------
/vsProject/paint3D/1.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 22.03.2012 09:44:38
3 |
4 | newmtl wire_008061138
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.0314 0.2392 0.5412
12 | Ks 0.3500 0.3500 0.3500
13 |
14 | newmtl wire_214228153
15 | Ns 32
16 | d 1
17 | Tr 1
18 | Tf 1 1 1
19 | illum 2
20 | Ka 0.0000 0.0000 0.0000
21 | Kd 0.8392 0.8941 0.6000
22 | Ks 0.3500 0.3500 0.3500
23 |
--------------------------------------------------------------------------------
/vsProject/paint3D/2.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 04.04.2012 12:16:20
3 |
4 | newmtl wire_224086086
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.8784 0.3373 0.3373
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/3.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 28.03.2012 21:03:50
3 |
4 | newmtl wire_138008110
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.5412 0.0314 0.4314
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/BlendCurveGraphWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "BlendCurveGraphWidget.h"
3 |
4 |
5 | BlendCurveGraphWidget::BlendCurveGraphWidget( QWidget *parent /*= 0*/, Qt::WindowFlags flags /*= 0*/ ): QWidget(parent, flags)
6 | {
7 | for (int i = 0; i < BLEND_CURVE_WIDGET_SEGMENTS;++i)
8 | {
9 | valueArray[i] = 1.0f;
10 | }
11 | }
12 |
13 | BlendCurveGraphWidget::~BlendCurveGraphWidget(void)
14 | {
15 | }
16 |
17 |
18 | void BlendCurveGraphWidget::paintEvent( QPaintEvent *event )
19 | {
20 | QPainter painter(this);
21 | QSize size = this->size();
22 | painter.setBrush(QBrush(QColor(150,150,150,255)));
23 | painter.setPen(Qt::NoPen);
24 | QVector points;
25 | for (int i = 0; i < BLEND_CURVE_WIDGET_SEGMENTS; ++i)
26 | {
27 | float x = i / float(BLEND_CURVE_WIDGET_SEGMENTS - 1) * size.width() ;
28 | float y = (1.0f - valueArray[i]) * size.height();
29 | points.push_back(QPointF(x,y));
30 | }
31 | points.push_back(QPointF(size.width(), size.height()));
32 | points.push_back(QPointF(0, size.height()));
33 | painter.drawPolygon(&points[0], points.size());
34 | painter.setBrush(Qt::NoBrush);
35 | painter.setPen(Qt::SolidLine);
36 | painter.drawRect(0,0,size.width()-1, size.height()-1);
37 | }
38 |
39 |
40 | void BlendCurveGraphWidget::setCurve( float v0, float v1, float w0, float w1 )
41 | {
42 | Brush::computeBlendCurve(valueArray, BLEND_CURVE_WIDGET_SEGMENTS, v0, v1, w0, w1);
43 | this->update();
44 | }
45 |
--------------------------------------------------------------------------------
/vsProject/paint3D/BlendCurveGraphWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #define BLEND_CURVE_WIDGET_SEGMENTS 30
3 | class BlendCurveGraphWidget :
4 | public QWidget
5 | {
6 | public:
7 | BlendCurveGraphWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
8 | ~BlendCurveGraphWidget(void);
9 |
10 | void setCurve(float v0, float v1, float w0, float w1);
11 |
12 | protected:
13 | void paintEvent(QPaintEvent *event);
14 | private:
15 | float valueArray[BLEND_CURVE_WIDGET_SEGMENTS];
16 | };
17 |
--------------------------------------------------------------------------------
/vsProject/paint3D/BoundingBox.cpp:
--------------------------------------------------------------------------------
1 | #include "BoundingBox.h"
2 | #include "stdafx.h"
3 |
4 | float BoundingBox::delta = 1e-4f;
5 |
6 | BoundingBox::BoundingBox(void)
7 | {
8 | }
9 | BoundingBox::~BoundingBox(void)
10 | {
11 | }
12 | BoundingBox::BoundingBox(QVector3D ipMin,QVector3D ipMax)
13 | {
14 | pMin=ipMin;pMax=ipMax;
15 | }
16 | void BoundingBox::merge(const QVector3D&point,bool isBigger)
17 | {
18 | float e = 0.1f;
19 | if(isBigger)
20 | e = delta;
21 | if(pMin.x()>point.x()-e)pMin.setX(point.x()-e);
22 | if(pMin.y()>point.y()-e)pMin.setY(point.y()-e);
23 | if(pMin.z()>point.z()-e)pMin.setZ(point.z()-e);
24 | if(pMax.x()iBox.pMin.x())pMin.setX(iBox.pMin.x());
31 | if(pMin.y()>iBox.pMin.y())pMin.setY(iBox.pMin.y());
32 | if(pMin.z()>iBox.pMin.z())pMin.setZ(iBox.pMin.z());
33 | if(pMax.x()y)?((x>z)?0:2):((y>z)?1:2);
67 | }
68 | void BoundingBox::displayCoords()const
69 | {
70 | qDebug()<<"pMin: \t";
71 | qDebug() << pMin;
72 | qDebug()<<"pMax: ";
73 | qDebug() << pMax;
74 | qDebug()< iBox.pMin.x() ? pMin.x() : iBox.pMin.x());
111 | resultBox.pMax.setX(pMax.x() < iBox.pMax.x() ? pMax.x() : iBox.pMax.x());
112 | if (resultBox.pMin.x() > resultBox.pMax.x())
113 | return false;
114 | resultBox.pMin.setY(pMin.y() > iBox.pMin.y() ? pMin.y() : iBox.pMin.y());
115 | resultBox.pMax.setY(pMax.y() < iBox.pMax.y() ? pMax.y() : iBox.pMax.y());
116 | if (resultBox.pMin.y() > resultBox.pMax.y())
117 | return false;
118 | resultBox.pMin.setZ(pMin.z() > iBox.pMin.z() ? pMin.z() : iBox.pMin.z());
119 | resultBox.pMax.setZ(pMax.z() < iBox.pMax.z() ? pMax.z() : iBox.pMax.z());
120 | if (resultBox.pMin.z() > resultBox.pMax.z())
121 | return false;
122 | return true;
123 | }
124 |
125 | bool BoundingBox::isInBoxInclusive( const QVector3D& point )
126 | {
127 | return point.x() >= pMin.x() && point.y() >= pMin.y() && point.z() >= pMin.z() &&
128 | point.x() <= pMax.x() && point.y() <= pMax.y() && point.z() <= pMax.z() ;
129 | }
130 |
131 | bool BoundingBox::isInBoxExclusive( const QVector3D& point )
132 | {
133 | return point.x() > pMin.x() && point.y() > pMin.y() && point.z() > pMin.z() &&
134 | point.x() < pMax.x() && point.y() < pMax.y() && point.z() < pMax.z() ;
135 | }
136 |
137 | bool BoundingBox::onFace( QVector3D& point, int& face )
138 | {
139 | if (point.x() == pMin.x())
140 | {
141 | face = 1; return true;
142 | }
143 | else if (point.x() == pMax.x())
144 | {
145 | face = 0; return true;
146 | }
147 | else if (point.y() == pMin.y())
148 | {
149 | face = 3; return true;
150 | }
151 | else if (point.y() == pMax.y())
152 | {
153 | face = 2; return true;
154 | }
155 | else if (point.z() == pMin.z())
156 | {
157 | face = 5; return true;
158 | }
159 | else if (point.z() == pMax.z())
160 | {
161 | face = 4; return true;
162 | }
163 | return false;
164 | }
--------------------------------------------------------------------------------
/vsProject/paint3D/BoundingBox.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/BoundingBox.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Brush.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Brush.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Brush.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Brush.h
--------------------------------------------------------------------------------
/vsProject/paint3D/BrushSettingWidget.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/BrushSettingWidget.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/BrushSettingWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include "ui_brushSetting.h"
4 |
5 | class BrushSettingWidget: public QScrollArea, Ui::BrushSetting
6 | {
7 | Q_OBJECT
8 | public:
9 | BrushSettingWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
10 | ~BrushSettingWidget(void);
11 |
12 | private slots:
13 | void setSize(double size);
14 | void setResolutionRatio(double ratio);
15 | void setAngle(double angle);
16 | void setRatio(double ratio);
17 | void setSizeJitter(double sizeJitter);
18 | void setAngleJitter(double angleJitter);
19 | void setRatioJitter(double ratioJitter);
20 | void setOffsetJitter(double offsetJitter);
21 | void setInterval(double interval);
22 | void setHardness(double hard);
23 | void setDepthRange(double dummy);
24 |
25 |
26 | void loadStrokeFromImage();
27 | void loadStrokeFromAbr();
28 | void setStroke(int ithStroke);
29 | private:
30 | void refreshListViewItem();
31 | };
32 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Camera.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "Camera.h"
3 |
4 | #include
5 |
6 | Camera::Camera(void)
7 | {
8 | resetCamera();
9 | }
10 |
11 |
12 | Camera::~Camera(void)
13 | {
14 | }
15 |
16 | void Camera::computeViewParam()
17 | {
18 | QVector3D xRotAxis = QVector3D(0,0,direction[1].z());
19 | QQuaternion xRotQuat = QQuaternion::fromAxisAndAngle(xRotAxis, deltaAngle[0]);
20 | direction[0] = xRotQuat.rotatedVector(direction[0]);
21 | QQuaternion yRotQuat = QQuaternion::fromAxisAndAngle(direction[0], deltaAngle[1]);
22 | QQuaternion rotQuat = yRotQuat * xRotQuat;
23 |
24 | direction[1] = rotQuat.rotatedVector(direction[1]);
25 | direction[2] = rotQuat.rotatedVector(direction[2]);
26 |
27 | origin = target - direction[2] * length;
28 |
29 | viewMatrix.setToIdentity();
30 | viewMatrix.lookAt(origin, target, direction[1]);
31 |
32 | }
33 | void Camera::computeAttachedTransfrom()
34 | {
35 | float tanAngle = tan(CAMERA_FOV_Y_RAD / 2.0f);
36 | double h = tanAngle * length;
37 | double w = h * aspectRatio;
38 | float xOffset = w * attachOffset[0];
39 | float yOffset = h * attachOffset[1];
40 | float zOffset = length * attachOffset[2] + 1;
41 | QQuaternion localQuat = QQuaternion::fromAxisAndAngle(0,0,1,attachRotation);
42 | QVector3D trans;QQuaternion rot;
43 | this->getCameraTransform(trans, rot);
44 | for (int i = 0; i < attachedObjects.size(); ++i)
45 | {
46 | if (attachedObjects[i])
47 | {
48 | RenderableObject* obj = attachedObjects[i].data();
49 | obj->getTransform().setRotate(localQuat);
50 | obj->getTransform().rotate(rot, target);
51 | obj->getTransform().setTranslate(origin + direction[0] * xOffset + direction[1] * yOffset + direction[2] * zOffset);
52 | obj->getTransform().setScale(QVector3D(attachScale[0] * w, attachScale[1] * h, 1));
53 | }
54 | }
55 | }
56 |
57 | void Camera::computeProjParam()
58 | {
59 | projMatrix.setToIdentity();
60 | if(projType == Camera::GLCAMERA_PERSP)
61 | {
62 | projMatrix.perspective(CAMERA_FOV_Y_DEGREE, aspectRatio, 0.2,100);
63 | }
64 | else
65 | {
66 | float tanAngle = tan(CAMERA_FOV_Y_RAD / 2.0f);
67 | double h = tanAngle * length;
68 | double w = h * aspectRatio;
69 | projMatrix.ortho(-w, w, -h, h, 0, 1000);
70 | }
71 | }
72 |
73 |
74 | void Camera::setScreenResolution( int x, int y )
75 | {
76 | screenRes[0] = x; screenRes[1] = y;
77 | glViewport(0,0,x,y);
78 | aspectRatio = screenRes[0] / (double)screenRes[1];
79 | updateAll();
80 | }
81 |
82 |
83 | void Camera::rotateCamera( double dx, double dy )
84 | {
85 | deltaAngle[0] -= dx / 5.0;
86 | deltaAngle[1] -= dy / 5.0;
87 | updateAll();
88 | deltaAngle[0] = deltaAngle[1] = 0.0f;
89 | }
90 |
91 | void Camera::moveCamera( double dx, double dy )
92 | {
93 | dx /= 100; dy/= 100;
94 | target -= direction[0] * dx - direction[1] * dy;
95 | updateAll();
96 | }
97 |
98 | void Camera::zoomCamera( double dz )
99 | {
100 | float newLength = max(0.1, length- dz / 90.0f);
101 | deltaLength = length - newLength;
102 | length = newLength;
103 | updateAll();
104 | deltaLength = 0;
105 | }
106 |
107 | void Camera::getRay( int x, int y, QVector3D& ori, QVector3D& dir )
108 | {
109 | double xRatio = x / (double)screenRes[0] * 2.0 - 1.0;
110 | double yRatio = 1.0 - y / (double)screenRes[1] * 2.0;
111 |
112 | if (projType == Camera::GLCAMERA_ORTHO)
113 | {
114 | double h = tan(CAMERA_FOV_Y_RAD / 2.0f) * length;
115 | double w = h * aspectRatio;
116 | xRatio *= w;
117 | yRatio *= h;
118 | ori.setX(origin.x() + xRatio * direction[0].x() + yRatio * direction[1].x());
119 | ori.setY(origin.y() + xRatio * direction[0].y() + yRatio * direction[1].y());
120 | ori.setZ(origin.z() + xRatio * direction[0].z() + yRatio * direction[1].z());
121 | dir = direction[2];
122 | }
123 | else
124 | {
125 | double h = tan(CAMERA_FOV_Y_RAD / 2.0f);
126 | double w = h * aspectRatio;
127 | xRatio *= w;
128 | yRatio *= h;
129 | QVector3D vd = direction[2] + direction[0] * xRatio + direction[1] * yRatio;
130 | vd.normalize();
131 | ori = origin;
132 | dir = vd;
133 | }
134 | }
135 |
136 | void Camera::setProjMode( ProjType type )
137 | {
138 | projType = type;
139 | computeProjParam();
140 | }
141 |
142 | void Camera::resetCamera()
143 | {
144 | projType = GLCAMERA_PERSP;
145 | screenRes[0] = 640;
146 | screenRes[1] = 480;
147 | aspectRatio = screenRes[1] / (double)screenRes[0];
148 | origin = QVector3D(10,0,0);
149 | target = QVector3D(0,0,0);
150 | direction[0] = QVector3D(0,1,0);
151 | direction[1] = QVector3D(0,0,1);
152 | direction[2] = QVector3D(-1,0,0);
153 | deltaAngle[0] = CAMERA_INIT_ALPHA_DEGREE;
154 | deltaAngle[1] = CAMERA_INIT_BETA_DEGREE;
155 | deltaLength = 0;
156 | length = 10.0f;
157 | attachOffset[0] = attachOffset[1] = attachOffset[2] = 0;
158 | attachRotation = 0;
159 | attachScale[0] = attachScale[1] = 1;
160 |
161 | updateAll();
162 | }
163 |
164 | void Camera::applyGLMatrices()
165 | {
166 | glMatrixMode(GL_MODELVIEW);
167 | glLoadMatrixf(viewMatrix.constData());
168 | glMatrixMode(GL_PROJECTION);
169 | glLoadMatrixf(projMatrix.constData());
170 | }
171 |
172 |
173 | void Camera::setCenter( QVector3D& center, float distance /*= 10*/ )
174 | {
175 | target = center;
176 | length = distance;
177 | updateAll();
178 | }
179 |
180 | QVector3D Camera::getWorldPos( float xRatio, float yRatio, float zRatio )const
181 | {
182 | float xR = xRatio * 2.0 - 1.0;
183 | float yR = 1.0 - yRatio * 2.0;
184 | QVector3D ori, dir;
185 |
186 | if (projType == Camera::GLCAMERA_ORTHO)
187 | {
188 | double h = tan(CAMERA_FOV_Y_RAD / 2.0f) * length;
189 | double w = h * aspectRatio;
190 | xR *= w;
191 | yR *= h;
192 | ori.setX(origin.x() + xR * direction[0].x() + yR * direction[1].x());
193 | ori.setY(origin.y() + xR * direction[0].y() + yR * direction[1].y());
194 | ori.setZ(origin.z() + xR * direction[0].z() + yR * direction[1].z());
195 | dir = direction[2];
196 | }
197 | else
198 | {
199 | double h = tan(CAMERA_FOV_Y_RAD / 2.0f);
200 | double w = h * aspectRatio;
201 | xR *= w;
202 | yR *= h;
203 | QVector3D vd = direction[2] + direction[0] * xR + direction[1] * yR;
204 | ori = origin;
205 | dir = vd;
206 | }
207 | dir.normalize();
208 | // float z = depthRatio / (1 - depthRatio);
209 | // return ori + z * dir;
210 | return ori + zRatio * dir;
211 | }
212 |
213 | QVector3D Camera::getWorldNormalFromView( const QVector3D& viewNormal )
214 | {
215 | return QVector3D(
216 | viewNormal.x() * direction[0].x() + viewNormal.y() * direction[1].x() + viewNormal.z() * -direction[2].x(),
217 | viewNormal.x() * direction[0].y() + viewNormal.y() * direction[1].y() + viewNormal.z() * -direction[2].y(),
218 | viewNormal.x() * direction[0].z() + viewNormal.y() * direction[1].z() + viewNormal.z() * -direction[2].z());
219 | }
220 |
221 | void Camera::getCameraTransform( QVector3D& trans, QQuaternion& rot )
222 | {
223 | trans = origin+direction[2];
224 |
225 | float xAngle = atan2(direction[0].y(), direction[0].x()) / M_PI * 180.0f;
226 | QQuaternion rotX = QQuaternion::fromAxisAndAngle(0,0,1,xAngle);
227 | float x = -direction[2].z();
228 | float y = direction[1].z();
229 | float yAngle = atan2(y,x) / M_PI * 180.0f;
230 | QVector3D newX = rotX.rotatedVector(QVector3D(1,0,0));
231 | QQuaternion rotY = QQuaternion::fromAxisAndAngle(newX, yAngle);
232 | rot = rotY * rotX;
233 |
234 | }
235 |
236 | void Camera::getScreenSize(float&w, float&h)
237 | {
238 | if (projType == Camera::GLCAMERA_ORTHO)
239 | {
240 | h = 2 * tan(CAMERA_FOV_Y_RAD / 2.0f) * length;
241 | }
242 | else
243 | h = 2 * tan(CAMERA_FOV_Y_RAD / 2.0f);
244 | w = h * aspectRatio;
245 | }
246 |
247 | void Camera::addAttachedObjects( const QWeakPointer obj )
248 | {
249 | attachedObjects.push_back(obj);
250 | updateAll();
251 | }
252 |
253 | void Camera::clearAttachedObjects()
254 | {
255 | attachedObjects.clear();
256 | }
257 |
258 | void Camera::setAttachObjectOffset( float x, float y, float z )
259 | {
260 | attachOffset[0] = x;
261 | attachOffset[1] = y;
262 | attachOffset[2] = z;
263 | updateAll();
264 | }
265 |
266 | void Camera::setAttachObjectRotation( float angle )
267 | {
268 | attachRotation = angle;
269 | updateAll();
270 | }
271 |
272 | void Camera::setAttachObjectScale( float x, float y )
273 | {
274 | attachScale[0] = x;
275 | attachScale[1] = y;
276 | updateAll();
277 | }
278 |
279 | void Camera::updateAll()
280 | {
281 | computeViewParam();
282 | computeProjParam();
283 | computeAttachedTransfrom();
284 | deltaAngle[0] = deltaAngle[1] = 0;
285 | deltaLength = 0;
286 | }
287 |
288 |
289 |
290 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Camera.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Camera.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Canvas.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Canvas.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Canvas.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Canvas.h
--------------------------------------------------------------------------------
/vsProject/paint3D/CanvasSeamFiller.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/CanvasSeamFiller.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/CanvasSeamFiller.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/CanvasSeamFiller.h
--------------------------------------------------------------------------------
/vsProject/paint3D/ColorSelectButton.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "ColorSelectButton.h"
3 | #include
4 |
5 |
6 | ColorSelectButton::ColorSelectButton( QWidget * parent /*= 0 */ ):QPushButton(parent)
7 | {
8 | connect(this, SIGNAL(clicked()), this, SLOT(selectColor()));
9 | }
10 |
11 | ColorSelectButton::~ColorSelectButton(void)
12 | {
13 | }
14 |
15 | void ColorSelectButton::selectColor()
16 | {
17 | QColorDialog dialog(color, 0);
18 | dialog.setOption(QColorDialog::ShowAlphaChannel, false);
19 | // The ifdef block is a workaround for the beta, TODO: remove when bug 238525 is fixed
20 | #ifdef Q_WS_MAC
21 | dialog.setOption(QColorDialog::DontUseNativeDialog, true);
22 | #endif
23 | dialog.move(280, 120);
24 | if (dialog.exec() == QDialog::Rejected)
25 | return;
26 | color = dialog.selectedColor();
27 | emit colorChanged(color);
28 | }
29 |
30 | void ColorSelectButton::paintEvent( QPaintEvent *event )
31 | {
32 | QPainter painter(this);
33 | QSize size = this->size();
34 | painter.fillRect(0,0,size.width(),size.height(),color);
35 | }
36 |
--------------------------------------------------------------------------------
/vsProject/paint3D/ColorSelectButton.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | class ColorSelectButton:public QPushButton
5 | {
6 | Q_OBJECT
7 | public:
8 | ColorSelectButton( QWidget * parent = 0 );
9 | ~ColorSelectButton(void);
10 |
11 | QColor getColor(){return color;}
12 | signals:
13 | void colorChanged(QColor color);
14 |
15 | private slots:
16 | void selectColor();
17 | protected:
18 | void paintEvent(QPaintEvent *event);
19 | private:
20 | QColor color;
21 | };
22 |
--------------------------------------------------------------------------------
/vsProject/paint3D/CubeMap.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/CubeMap.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/CubeMap.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/CubeMap.h
--------------------------------------------------------------------------------
/vsProject/paint3D/GLContext.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "GLContext.h"
3 |
4 | GLContext* GLContext::context = NULL;
5 |
6 | GLContext::GLContext(void)
7 | {
8 | }
9 |
10 | GLContext::~GLContext(void)
11 | {
12 | }
13 |
14 | GLContext* GLContext::instance()
15 | {
16 | if (context == NULL)
17 | {
18 | context = new GLContext;
19 | }
20 | return context;
21 | }
22 |
--------------------------------------------------------------------------------
/vsProject/paint3D/GLContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | class GLContext
4 | {
5 | public:
6 | ~GLContext(void);
7 |
8 | static GLContext* instance();
9 | QGLFunctions* getQGLFunctions(){return &glFunctions;}
10 | private:
11 | GLContext(void);
12 | static GLContext* context;
13 | QGLFunctions glFunctions;
14 | };
15 |
--------------------------------------------------------------------------------
/vsProject/paint3D/GLScene.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GLScene.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/GLScene.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GLScene.h
--------------------------------------------------------------------------------
/vsProject/paint3D/GLViewWidget.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GLViewWidget.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/GLViewWidget.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GLViewWidget.h
--------------------------------------------------------------------------------
/vsProject/paint3D/GeometryExposer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GeometryExposer.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/GeometryExposer.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/GeometryExposer.h
--------------------------------------------------------------------------------
/vsProject/paint3D/HistoryCommand.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "HistoryCommand.h"
3 | #include "Paint3DFrame.h"
4 |
5 | ManipulateCommand::ManipulateCommand(
6 | unsigned objID,
7 | const ObjectTransform& oldTransform,
8 | const ObjectTransform& newTransform ,
9 | ManipulateCommandType type)
10 | {
11 | this->type = type;
12 | this->objID = objID;
13 | this->oldTransform = oldTransform;
14 | this->newTransform = newTransform;
15 | switch(type)
16 | {
17 | case MANCMD_TRANSLATE:
18 | this->setText(QObject::tr("Translate Object")); break;
19 | case MANCMD_ROTATE:
20 | this->setText(QObject::tr("Rotate Object")); break;
21 | case MANCMD_SCALE:
22 | this->setText(QObject::tr("Scale Object")); break;
23 | case MANCMD_ALL:
24 | this->setText(QObject::tr("Change Object Transform"));
25 | }
26 | }
27 |
28 | void ManipulateCommand::undo()
29 | {
30 | RenderableObject* obj = Paint3DFrame::getInstance()->scene->getObject(objID).data();
31 | if (obj)
32 | {
33 | obj->setTransform(oldTransform);
34 | Paint3DFrame::getInstance()->scene->updateGeometryImage();
35 | Paint3DFrame::getInstance()->updateGLView();
36 | }
37 | }
38 |
39 | void ManipulateCommand::redo()
40 | {
41 | RenderableObject* obj = Paint3DFrame::getInstance()->scene->getObject(objID).data();
42 | if (obj)
43 | {
44 | obj->setTransform(newTransform);
45 | Paint3DFrame::getInstance()->scene->updateGeometryImage();
46 | Paint3DFrame::getInstance()->updateGLView();
47 | }
48 | }
49 |
50 | void PaintCommand::undo()
51 | {
52 | RenderableObject* obj = Paint3DFrame::getInstance()->scene->getObject(objID).data();
53 | if (obj && obj->getType() & RenderableObject::CMP_MESH)
54 | {
55 | Mesh* mesh = (Mesh*)obj;
56 | int width, height;
57 | Canvas& canvas = mesh->getCanvas();
58 | canvas.getResolution(width, height);
59 | canvas.selectLayer(curLayer);
60 | for (QVector::iterator pR = pixelRecords.begin(); pR != pixelRecords.end(); ++pR)
61 | {
62 | int y = pR->index / width;
63 | int x = pR->index - y * width;
64 | canvas.setCurLayerColorPixel(x, y, pR->oldBGRAi);
65 | canvas.setCurLayerSurfacePixel(x, y, pR->oldSurfi);
66 | canvas.setCurLayerThicknessPixel(x, y, pR->oldThickness);
67 | }
68 | canvas.updateGLTextures();
69 | Paint3DFrame::getInstance()->updateGLView();
70 | }
71 | }
72 |
73 | void PaintCommand::redo()
74 | {
75 | RenderableObject* obj = Paint3DFrame::getInstance()->scene->getObject(objID).data();
76 | if (obj && obj->getType() == RenderableObject::CMP_MESH)
77 | {
78 | Mesh* mesh = (Mesh*)obj;
79 | int width, height;
80 | Canvas& canvas = mesh->getCanvas();
81 | canvas.getResolution(width, height);
82 | canvas.selectLayer(curLayer);
83 | for (QVector::iterator pR = pixelRecords.begin(); pR != pixelRecords.end(); ++pR)
84 | {
85 | int y = pR->index / width;
86 | int x = pR->index - y * width;
87 | canvas.setCurLayerColorPixel(x, y, pR->newBGRAi);
88 | canvas.setCurLayerSurfacePixel(x, y, pR->newSurfi);
89 | canvas.setCurLayerThicknessPixel(x, y, pR->newThickness);
90 | }
91 | canvas.updateGLTextures();
92 | Paint3DFrame::getInstance()->updateGLView();
93 | }
94 | }
95 |
96 | void PaintCommand::addRecord( const PixelRecord& record )
97 | {
98 | pixelRecords.push_back(record);
99 | }
100 |
101 | PaintCommand::PaintCommand( unsigned objID, int curLayer )
102 | {
103 | this->objID = objID;
104 | this->curLayer = curLayer;
105 | this->setText(QObject::tr("Paint Object"));
106 | }
107 |
108 | void AddLayerCommand::undo()
109 | {
110 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
111 | if (mesh)
112 | {
113 | QSharedPointer dummy;
114 | mesh->getCanvas().removeLayer(dummy, layerPos);
115 | Paint3DFrame::getInstance()->updateGLView();
116 | Paint3DFrame::getInstance()->layerEditor->updateList();
117 | }
118 | }
119 |
120 | void AddLayerCommand::redo()
121 | {
122 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
123 | if (mesh)
124 | {
125 | mesh->getCanvas().insertLayer(layer, layerPos);
126 | Paint3DFrame::getInstance()->updateGLView();
127 | Paint3DFrame::getInstance()->layerEditor->updateList();
128 | }
129 | }
130 |
131 |
132 | AddLayerCommand::AddLayerCommand( QSharedPointerlayer, int layerPos, int objID )
133 | {
134 | this->layer = layer;
135 | this->setText(QObject::tr("Add Layer"));
136 | this->layerPos = layerPos;
137 | this->objID = objID;
138 | }
139 |
140 | DeleteLayerCommand::DeleteLayerCommand( QSharedPointerlayer, int layerPos, int objID )
141 | {
142 | this->layer = layer;
143 | this->setText(QObject::tr("Delete Layer"));
144 | this->layerPos = layerPos;
145 | this->objID = objID;
146 | }
147 |
148 | void DeleteLayerCommand::undo()
149 | {
150 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
151 | if (mesh)
152 | {
153 | mesh->getCanvas().insertLayer(layer, layerPos);
154 | Paint3DFrame::getInstance()->updateGLView();
155 | Paint3DFrame::getInstance()->layerEditor->updateList();
156 | }
157 | }
158 |
159 | void DeleteLayerCommand::redo()
160 | {
161 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
162 | if (mesh)
163 | {
164 | QSharedPointer dummy;
165 | mesh->getCanvas().removeLayer(dummy, layerPos);
166 | Paint3DFrame::getInstance()->updateGLView();
167 | Paint3DFrame::getInstance()->layerEditor->updateList();
168 | }
169 | }
170 |
171 | void MoveUpLayerCommand::undo()
172 | {
173 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
174 | if (mesh)
175 | {
176 | mesh->getCanvas().moveDownLayer(layerOriPos+1);
177 | Paint3DFrame::getInstance()->updateGLView();
178 | Paint3DFrame::getInstance()->layerEditor->updateList();
179 | }
180 | }
181 |
182 | void MoveUpLayerCommand::redo()
183 | {
184 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
185 | if (mesh)
186 | {
187 | mesh->getCanvas().moveUpLayer(layerOriPos);
188 | Paint3DFrame::getInstance()->updateGLView();
189 | Paint3DFrame::getInstance()->layerEditor->updateList();
190 | }
191 | }
192 |
193 |
194 | void MoveDownLayerCommand::undo()
195 | {
196 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
197 | if (mesh)
198 | {
199 | mesh->getCanvas().moveUpLayer(layerOriPos-1);
200 | Paint3DFrame::getInstance()->updateGLView();
201 | Paint3DFrame::getInstance()->layerEditor->updateList();
202 | }
203 | }
204 |
205 | void MoveDownLayerCommand::redo()
206 | {
207 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
208 | if (mesh)
209 | {
210 | mesh->getCanvas().moveDownLayer(layerOriPos);
211 | Paint3DFrame::getInstance()->updateGLView();
212 | Paint3DFrame::getInstance()->layerEditor->updateList();
213 | }
214 | }
215 |
216 | void SetLayerFromImageCommand::undo()
217 | {
218 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
219 | if (mesh)
220 | {
221 | mesh->getCanvas().setLayer(oldLayer, layerPos);
222 | Paint3DFrame::getInstance()->updateGLView();
223 | Paint3DFrame::getInstance()->layerEditor->updateList();
224 | }
225 | }
226 |
227 | void SetLayerFromImageCommand::redo()
228 | {
229 | Mesh* mesh = (Mesh*)Paint3DFrame::getInstance()->scene->getObject(objID).data();
230 | if (mesh)
231 | {
232 | mesh->getCanvas().setLayer(newLayer, layerPos);
233 | Paint3DFrame::getInstance()->updateGLView();
234 | Paint3DFrame::getInstance()->layerEditor->updateList();
235 | }
236 | }
237 |
238 | void RemoveObjectCommand::undo()
239 | {
240 | Paint3DFrame::getInstance()->scene->insertObject(object);
241 | Manipulator* curTool = Paint3DFrame::getInstance()->viewWidget->getCurTool();
242 | if (curTool)
243 | {
244 | curTool->captureObject(object);
245 | }
246 | }
247 |
248 | void RemoveObjectCommand::redo()
249 | {
250 | QWeakPointercurSelectObj = Paint3DFrame::getInstance()->viewWidget->getSelectedObject();
251 | Manipulator*& curTool = Paint3DFrame::getInstance()->viewWidget->getCurTool();
252 | if (object == curSelectObj)
253 | {
254 | Paint3DFrame::getInstance()->viewWidget->clearSelectedObject();
255 | }
256 | if (curTool && curTool->getCurObject() == object)
257 | {
258 | curTool->captureObject(curSelectObj);
259 | Paint3DFrame::getInstance()->viewWidget->setTool(GLViewWidget::TOOL_SELECT);
260 | }
261 | Paint3DFrame::getInstance()->scene->removeObject(object);
262 | }
263 |
--------------------------------------------------------------------------------
/vsProject/paint3D/HistoryCommand.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/HistoryCommand.h
--------------------------------------------------------------------------------
/vsProject/paint3D/HistoryWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "HistoryWidget.h"
3 | #include "Paint3DFrame.h"
4 | HistoryWidget::HistoryWidget(void)
5 | {
6 | setupUi(this);
7 | historyView->setEmptyLabel("");
8 | }
9 |
10 | HistoryWidget::~HistoryWidget(void)
11 | {
12 | }
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/HistoryWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ui_history.h"
3 |
4 | class HistoryWidget: public QWidget, Ui::History
5 | {
6 | Q_OBJECT
7 | public:
8 | HistoryWidget(void);
9 | ~HistoryWidget(void);
10 |
11 | void setUndoStack(QUndoStack* stack)
12 | {
13 | historyView->setStack(stack);
14 | }
15 | };
16 |
--------------------------------------------------------------------------------
/vsProject/paint3D/IconResource.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "myapp.ico"
--------------------------------------------------------------------------------
/vsProject/paint3D/Manipulator.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "Manipulator.h"
3 |
4 | const char Manipulator::otherAxis[3][2] = {{1,2},{0,2},{0,1}};
5 | const float Manipulator::cosTable[13] = {1, 0.87 ,0.5, 0, -0.5, -0.87, -1, -0.87, -0.5, 0, 0.5, 0.87,1};
6 | const float Manipulator::sinTable[13] = {0, 0.5, 0.87,1, 0.87 ,0.5, 0, -0.5, -0.87, -1, -0.87, -0.5, 0};
7 | const float Manipulator::axisColor[3][3] = {{1,0,0},{0,1,0},{0,0,1}};
8 |
9 | Manipulator::Manipulator(void)
10 | {
11 | isWorking = 0;
12 | }
13 |
14 |
15 | Manipulator::~Manipulator( void )
16 | {
17 |
18 | }
19 | /*
20 | void GLManipulator::setCenter( const QVector3D& center )
21 | {
22 | m_center = center;
23 | }*/
24 |
25 | bool Manipulator::intersectOriginCylinder( const QVector3D& rayOri, const QVector3D& rayDir,
26 | const char axis, const float radius, const float start, const float end, float& t )
27 | {
28 | char otherAxis0 = otherAxis[axis][0];
29 | char otherAxis1 = otherAxis[axis][1];
30 | float vOri[] = {rayOri.x(), rayOri.y(), rayOri.z()};
31 | float vDir[] = {rayDir.x(), rayDir.y(), rayDir.z()};
32 |
33 | float A = vDir[otherAxis0] * vDir[otherAxis0] + vDir[otherAxis1] * vDir[otherAxis1];
34 | float B = 2.0 *(vOri[otherAxis0] * vDir[otherAxis0] + vOri[otherAxis1] * vDir[otherAxis1]);
35 | float C = vOri[otherAxis0] * vOri[otherAxis0] + vOri[otherAxis1] * vOri[otherAxis1] - radius * radius;
36 | float delta = B * B - 4 * A * C;
37 | if (delta < 0) // not root
38 | return false;
39 | float rayT[2];
40 | rayT[0] = (-B + sqrt(delta)) / (2 * A);
41 | rayT[1] = (-B - sqrt(delta)) / (2 * A);
42 | float z0 = vOri[axis] + vDir[axis] * rayT[0];
43 | float z1 = vOri[axis] + vDir[axis] * rayT[1];
44 |
45 | bool isIsect[2];
46 | isIsect[0] = z0 > start && z0 < end && rayT[0] > 0;
47 | isIsect[1] = z1 > start && z1 < end && rayT[1] > 0;
48 | if (!isIsect[0] && !isIsect[1])
49 | return false;
50 |
51 | if (isIsect[0] && isIsect[1])
52 | t = min(rayT[0], rayT[1]);
53 | else if (isIsect[0])
54 | t = rayT[0];
55 | else
56 | t = rayT[1];
57 | return true;
58 | }
59 |
60 |
61 | bool Manipulator::intersectOriginDisk( const QVector3D& rayOri, const QVector3D& rayDir,
62 | const char axis, const float innerRadius, const float outerRadius, float& t )
63 | {
64 | float vOri[] = {rayOri.x(), rayOri.y(), rayOri.z()};
65 | float vDir[] = {rayDir.x(), rayDir.y(), rayDir.z()};
66 |
67 | float rayT = -vOri[axis] / vDir[axis];
68 | if (rayT > 0)
69 | {
70 | char otherAxis0 = otherAxis[axis][0];
71 | char otherAxis1 = otherAxis[axis][1];
72 |
73 | float v0 = vOri[otherAxis0] + rayT * vDir[otherAxis0];
74 | float v1 = vOri[otherAxis1] + rayT * vDir[otherAxis1];
75 |
76 | float r = sqrt(v0 * v0 + v1 * v1);
77 | if (r >=innerRadius && r <= outerRadius)
78 | {
79 | t = rayT;
80 | return true;
81 | }
82 | }
83 | return false;
84 | }
85 |
86 | float Manipulator::projRayToOriginAxis( const QVector3D& rayOri, const QVector3D& rayDir, const char axis )
87 | {
88 | float vOri[] = {rayOri.x(), rayOri.y(), rayOri.z()};
89 | float vDir[] = {rayDir.x(), rayDir.y(), rayDir.z()};
90 |
91 | float d12 = vDir[axis];
92 | float c1 = QVector3D::dotProduct(rayOri, rayDir);
93 | float c2 = vOri[axis];
94 | float denominator = 1 - d12 * d12;
95 | float absDeno = abs(denominator);
96 | if (absDeno < 0.01f)
97 | {
98 | denominator *= 0.01f / absDeno;
99 | }
100 | return (c2 - d12 * c1) / denominator;
101 | }
102 |
103 | float Manipulator::projRayToLine( const QVector3D& rayOri, const QVector3D& rayDir, const QVector3D& lineOri, const QVector3D& lineDir )
104 | {
105 | QVector3D ori = rayOri - lineOri;
106 | float c1 = QVector3D::dotProduct(ori, rayDir);
107 | float c2 = QVector3D::dotProduct(ori, lineDir);
108 | float d11 = 1;
109 | float d12 = QVector3D::dotProduct(rayDir,lineDir);
110 | float d22 = 1;
111 | float denominator = 1 - d12 * d12;
112 | float absDeno = abs(denominator);
113 | if (absDeno < 0.01f)
114 | {
115 | denominator *= 0.01f / absDeno;
116 | }
117 | return (c2*d11 - d12 * c1) / denominator;
118 | }
119 |
120 |
121 |
122 | void Manipulator::captureObject( QWeakPointer object )
123 | {
124 | curObject = object;
125 | if(curObject)
126 | {
127 | RenderableObject* obj = curObject.data();
128 | obj->select();
129 | }
130 | }
131 |
132 | void Manipulator::endManipulate()
133 | {
134 | RenderableObject* obj = curObject.data();
135 | if (obj)
136 | {
137 | newTransform = obj->getTransform();
138 | }
139 | isWorking = false;
140 | }
141 |
142 | void Manipulator::releaseObject()
143 | {
144 | if(!curObject.isNull())
145 | {
146 | curObject.data()->deselect();
147 | }
148 | curObject.clear();
149 | }
150 |
151 | void Manipulator::transformRayToLocal( QVector3D& ori, QVector3D& dir)
152 | {
153 | const QMatrix4x4& rotMat = getTransform()->getRotMatrix();
154 | ori = ori - curObject.data()->getCenter();
155 | ori = ori * rotMat;
156 | dir = dir * rotMat;
157 | }
158 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Manipulator.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Manipulator.h
--------------------------------------------------------------------------------
/vsProject/paint3D/MaterialLayerWidget.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/MaterialLayerWidget.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/MaterialLayerWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include "ui_materialLayer.h"
4 |
5 | QSharedPointer getScene();
6 | class MaterialLayerWidget: public QScrollArea, Ui::MaterialLayer
7 | {
8 | Q_OBJECT
9 | public:
10 | MaterialLayerWidget(void);
11 | ~MaterialLayerWidget(void);
12 | public slots:
13 | void updateList();
14 | void addLayer();
15 | void deleteLayer();
16 | void moveUpLayer();
17 | void moveDownLayer();
18 | void selectLayer(int ithLayer);
19 | void loadLayerFromImage();
20 | void saveLayerToImage();
21 | void saveCanvasToImage();
22 | private:
23 | Mesh* getSelectedMesh();
24 | };
25 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Mesh.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Mesh.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Mesh.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Mesh.h
--------------------------------------------------------------------------------
/vsProject/paint3D/ObjReader.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/ObjReader.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/ObjReader.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/ObjReader.h
--------------------------------------------------------------------------------
/vsProject/paint3D/ObjectTransformWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "ObjectTransformWidget.h"
3 | #include "Paint3DFrame.h"
4 |
5 | ObjectTransformWidget::ObjectTransformWidget(void)
6 | {
7 | setupUi(this);
8 |
9 | connect(transXSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
10 | connect(transYSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
11 | connect(transZSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
12 | connect(rotXSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
13 | connect(rotYSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
14 | connect(rotZSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
15 | connect(scaleXSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
16 | connect(scaleYSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
17 | connect(scaleZSpinBox, SIGNAL(editingFinished()), this, SLOT(updateSceneObject()));
18 | connect(nameEdit, SIGNAL(editingFinished()), this, SLOT(updateObjectName()));
19 | }
20 |
21 | ObjectTransformWidget::~ObjectTransformWidget(void)
22 | {
23 | }
24 |
25 | void ObjectTransformWidget::updateWidgets()
26 | {
27 | QSharedPointer pO = Paint3DFrame::getInstance()->viewWidget->getSelectedObject();
28 | if (pO)
29 | {
30 | ObjectTransform& trans =pO->getTransform();
31 | const QVector3D& pos = trans.getTranslate();
32 | transXSpinBox->setValue(pos.x());
33 | transYSpinBox->setValue(pos.y());
34 | transZSpinBox->setValue(pos.z());
35 | const QQuaternion& q= trans.getRotate();
36 | float w = q.scalar();
37 | float x = q.x();
38 | float y = q.y();
39 | float z = q.z();
40 | float a = atan2(2 *(w*x+y*z),1-2*(x*x+y*y));
41 | float b = asin(2*(w*y-z*x));
42 | float c = atan2(2*(w*z+x*y),1-2*(y*y+z*z));
43 | rotXSpinBox->setValue(a/M_PI*180);
44 | rotYSpinBox->setValue(b/M_PI*180);
45 | rotZSpinBox->setValue(c/M_PI*180);
46 | const QVector3D& sca = trans.getScale();
47 | scaleXSpinBox->setValue(sca.x());
48 | scaleYSpinBox->setValue(sca.y());
49 | scaleZSpinBox->setValue(sca.z());
50 | nameEdit->setText(pO->getName());
51 | }
52 | this->setEnabled(!pO.isNull());
53 | }
54 |
55 | void ObjectTransformWidget::updateSceneObject()
56 | {
57 | QSharedPointer pO = Paint3DFrame::getInstance()->viewWidget->getSelectedObject();
58 | if (pO)
59 | {
60 | ObjectTransform trans;
61 | trans.setTranslate(QVector3D(transXSpinBox->value(), transYSpinBox->value(), transZSpinBox->value()));
62 | float a = rotXSpinBox->value()/180.0*M_PI;
63 | float b = rotYSpinBox->value()/180.0*M_PI;
64 | float c = rotZSpinBox->value()/180.0*M_PI;
65 | float cosA2 = cos(a/2);
66 | float sinA2 = sin(a/2);
67 | float cosB2 = cos(b/2);
68 | float sinB2 = sin(b/2);
69 | float cosC2 = cos(c/2);
70 | float sinC2 = sin(c/2);
71 | QQuaternion newQuat;
72 | newQuat.setScalar(cosA2*cosB2*cosC2+sinA2*sinB2*sinC2);
73 | newQuat.setX (sinA2*cosB2*cosC2-cosA2*sinB2*sinC2);
74 | newQuat.setY (cosA2*sinB2*cosC2+sinA2*cosB2*sinC2);
75 | newQuat.setZ (cosA2*cosB2*sinC2-sinA2*sinB2*cosC2);
76 | trans.setRotate(newQuat);
77 | trans.setScale(QVector3D(scaleXSpinBox->value(), scaleYSpinBox->value(), scaleZSpinBox->value()));
78 | QUndoCommand* cmd = new ManipulateCommand(pO->getObjectID(),pO->getTransform(),trans, ManipulateCommand::MANCMD_ALL);
79 | Paint3DFrame::getInstance()->scene->getUndoStack().push(cmd);
80 | }
81 | }
82 |
83 | void ObjectTransformWidget::updateObjectName()
84 | {
85 | QString oldName = Paint3DFrame::getInstance()->viewWidget->getSelectedObject()->getName();
86 | Paint3DFrame::getInstance()->scene->rename(oldName, nameEdit->text());
87 | nameEdit->setText(Paint3DFrame::getInstance()->viewWidget->getSelectedObject()->getName());
88 | }
89 |
--------------------------------------------------------------------------------
/vsProject/paint3D/ObjectTransformWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ui_object.h"
3 |
4 | class ObjectTransformWidget:public QScrollArea,Ui::TransformEditor
5 | {
6 | Q_OBJECT
7 | public:
8 | ObjectTransformWidget(void);
9 | ~ObjectTransformWidget(void);
10 |
11 | public slots:
12 | void updateWidgets();
13 | void updateSceneObject();
14 | void updateObjectName();
15 | };
16 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Paint3DFrame.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Paint3DFrame.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Paint3DFrame.h:
--------------------------------------------------------------------------------
1 | #ifndef PAINT3D_H
2 | #define PAINT3D_H
3 |
4 | #include
5 | #include "ui_mainWindow.h"
6 |
7 | class Paint3DFrame : public QMainWindow, public Ui::MainWindow
8 | {
9 | Q_OBJECT
10 | public:
11 | ~Paint3DFrame();
12 |
13 | static Paint3DFrame* getInstance();
14 | static QSharedPointer scene;
15 | Scene* getScene(){return scene.data();}
16 | void initialize();
17 | void updateGLView();
18 | private slots:
19 | void importModel();
20 | void selectTool();
21 | void selectFaceTool();
22 | void moveTool();
23 | void rotateTool();
24 | void scaleTool();
25 | void focusTool();
26 | void paintTool();
27 | void openFile();
28 | void saveFile();
29 | void newFile();
30 |
31 | void refreshView();
32 | void createPlaneLocator();
33 |
34 | void showAboutWindow();
35 | private:
36 | Paint3DFrame(QWidget *parent = 0, Qt::WindowFlags flags = 0);
37 | static Paint3DFrame* instance;
38 | QActionGroup *actionGroup;
39 | QAction* undoAction;
40 | QAction* redoAction;
41 | };
42 |
43 | #endif // PAINT3D_H
44 |
--------------------------------------------------------------------------------
/vsProject/paint3D/PaintPicker.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/PaintPicker.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/PaintPicker.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/PaintPicker.h
--------------------------------------------------------------------------------
/vsProject/paint3D/PaintSettingWidget.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/PaintSettingWidget.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/PaintSettingWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ui_paintSetting.h"
3 |
4 | class Paint3DFrame;
5 |
6 | class PaintSettingWidget:public QScrollArea, public Ui::PaintSetting
7 | {
8 | Q_OBJECT
9 | public:
10 | PaintSettingWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
11 | ~PaintSettingWidget(void);
12 |
13 | public slots:
14 | void updateWidgets();
15 | void setColor( QColor color );
16 | void setColor( double dummy );
17 | void setSurface(double dummy);
18 | void setThickness(double thick);
19 | void setPickerOpacity(double opacity);
20 | void attachToCamera(bool isAttach);
21 | void setAttachingParam(double dummy);
22 |
23 | void setColorTex();
24 | void setReflTex();
25 | void setGlosTex();
26 | void setRefrTex();
27 | void setIORTex();
28 | void setThicknessTex();
29 |
30 | void clearColorTex();
31 | void clearReflTex();
32 | void clearGlosTex();
33 | void clearRefrTex();
34 | void clearIORTex();
35 | void clearThicknessTex();
36 |
37 | void setAffectColor(int isAffect);
38 | void setAffectReflLevel(int isAffect);
39 | void setAffectRefrLevel(int isAffect);
40 | void setAffectGlossness(int isAffect);
41 | void setAffectIOR(int isAffect);
42 | void setAffectThickness(int isAffect);
43 |
44 | void computeNormalBlendCurve(double dummy);
45 | void computeDepthBlendCurve(double dummy);
46 | void setDepthMode(int mode);
47 | void changeColorPicker(bool dummy);
48 | void pickColorPickerFromScene();
49 | void refreshPickerList();
50 |
51 | void setBrushMode(bool isBrushMode);
52 |
53 | private:
54 | QString openImageFile();
55 | QImage convertToGrayScale(const QImage& img);
56 | void detachFromCamera();
57 | QPixmap nullPixmap;
58 | };
59 |
60 | void getPickedObject(QSharedPointer obj);
--------------------------------------------------------------------------------
/vsProject/paint3D/Painter.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Painter.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Painter.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Painter.h
--------------------------------------------------------------------------------
/vsProject/paint3D/RenderableObject.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/RenderableObject.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/RenderableObject.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/RenderableObject.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/arrow.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/brush.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/brush.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/copy.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/cut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/cut.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/fileIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/fileIcon.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/focus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/focus.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/import.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/minus.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/move.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/move.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/move.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/move.psd
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/new.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/null.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/null.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/open.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/paint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/paint.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/paste.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/paste.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/planeLocator .png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/planeLocator .png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/plus.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/redo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/redo.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/rotate.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/save.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/scale.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/scale.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/select.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/select.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/selectFace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/selectFace.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/selectFace.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/selectFace.psd
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/software.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/software.png
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/software_1337421205.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/software_1337421205.ico
--------------------------------------------------------------------------------
/vsProject/paint3D/Resources/undo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Resources/undo.png
--------------------------------------------------------------------------------
/vsProject/paint3D/RotateManipulator.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "RotateManipulator.h"
3 | #include
4 | RotateManipulator::RotateManipulator(void)
5 | {
6 | setSize(1.0f);
7 | }
8 |
9 |
10 | RotateManipulator::~RotateManipulator(void)
11 | {
12 | }
13 |
14 | void RotateManipulator::draw(Camera& camera)
15 | {
16 | if (curObject.isNull())
17 | return;
18 |
19 | QVector3D center = curObject.data()->getCenter();
20 | QVector3D delta = camera.getOrigin() - center;
21 | if (!isWorking)
22 | {
23 | setSize(delta.length() * M_SIZE_FACTOR);
24 | }
25 |
26 | glEnable (GL_CULL_FACE);
27 | glCullFace(GL_BACK);
28 | glDisable(GL_LIGHTING);
29 | glDisable(GL_DEPTH_TEST);
30 | glMatrixMode(GL_MODELVIEW);
31 | glPushMatrix();
32 | glMultMatrixf(getTransform()->getTransRotMatrix().constData());
33 | glLineWidth(3.0f);
34 |
35 | float angle = 0;
36 | float deltaAngle = 3.1416 * 2 / ROT_M_BALL_SEGMENTS;
37 |
38 | float color[3][3];
39 | memcpy(color, axisColor, sizeof(float) * 9);
40 | color[curSelectedAxis][0] = 1;
41 | color[curSelectedAxis][1] = 1;
42 | color[curSelectedAxis][2] = 0;
43 |
44 | glBegin(GL_QUADS);
45 | for (char segment = 0; segment < ROT_M_BALL_SEGMENTS; segment++)
46 | {
47 | float cosAgl0 = cos(angle) * ballRadius;
48 | float sinAgl0 = sin(angle) * ballRadius;
49 | angle += deltaAngle;
50 | float cosAgl1 = cos(angle) * ballRadius;
51 | float sinAgl1 = sin(angle) * ballRadius;
52 |
53 | glColor3fv(color[0]);
54 | glVertex3f(-ballWidth, cosAgl0, sinAgl0);
55 | glVertex3f(-ballWidth, cosAgl1, sinAgl1);
56 | glVertex3f(ballWidth, cosAgl1, sinAgl1);
57 | glVertex3f(ballWidth, cosAgl0, sinAgl0);
58 |
59 | glColor3fv(color[1]);
60 | glVertex3f(cosAgl0, -ballWidth, sinAgl0);
61 | glVertex3f(cosAgl0, ballWidth, sinAgl0);
62 | glVertex3f(cosAgl1, ballWidth, sinAgl1);
63 | glVertex3f(cosAgl1, -ballWidth, sinAgl1);
64 |
65 | glColor3fv(color[2]);
66 | glVertex3f(cosAgl0, sinAgl0, -ballWidth);
67 | glVertex3f(cosAgl1, sinAgl1, -ballWidth);
68 | glVertex3f(cosAgl1, sinAgl1, ballWidth);
69 | glVertex3f(cosAgl0, sinAgl0, ballWidth);
70 | }
71 | glEnd();
72 |
73 | glPopMatrix();
74 | glEnable(GL_DEPTH_TEST);
75 | }
76 |
77 | char RotateManipulator::intersect( const QVector3D& rayOri, const QVector3D& rayDir )
78 | {
79 | float t;
80 | int bestAxis = -1;
81 | if (!curObject.isNull())
82 | {
83 | QVector3D ori = rayOri, dir = rayDir;
84 | transformRayToLocal(ori, dir);
85 |
86 | float bestT = FLT_MAX;
87 | for (int axis = 0; axis < 3; ++axis)
88 | {
89 | if(intersectOriginCylinder(ori, dir, axis, ballRadius, -detectWidth, detectWidth, t))
90 | {
91 | if (t < bestT)
92 | {
93 | bestT = t;
94 | bestAxis = axis;
95 | }
96 | }
97 | if (intersectOriginDisk(ori, dir, axis, ballRadius - detectWidth,ballRadius, t))
98 | {
99 | if (t < bestT)
100 | {
101 | bestT = t;
102 | bestAxis = axis;
103 | }
104 | }
105 | }
106 | }
107 | return bestAxis;
108 | }
109 |
110 | void RotateManipulator::beginManipulate( const QVector3D& rayOri, const QVector3D& rayDir, char axis )
111 | {
112 | M_CHECK_OBJECT(curObject)
113 |
114 | QVector3D ori = rayOri, dir = rayDir;
115 | transformRayToLocal(ori, dir);
116 | beginMatrix = getTransform()->getRotMatrix();
117 | QVector3D center = curObject.data()->getCenter();
118 |
119 | float t0 = FLT_MAX, t1 = FLT_MAX, t;
120 | intersectOriginCylinder(ori, dir, axis, ballRadius, -detectWidth, detectWidth, t0);
121 | intersectOriginDisk(ori, dir, axis, ballRadius - detectWidth,ballRadius, t1);
122 | t = min(t0, t1);
123 | QVector3D pt = ori + t * dir;
124 | float ptV[] = {pt.x(), pt.y(), pt.z()};
125 | ptV[axis] = 0;
126 | pt = QVector3D(ptV[0], ptV[1], ptV[2]);
127 | float axisV[] = {0,0,0};
128 | axisV[axis] = 1;
129 | QVector3D axisVector(axisV[0], axisV[1], axisV[2]);
130 | rotLineTangent = QVector3D::crossProduct(axisVector,pt);
131 | rotLineTangent.normalize();
132 | rotLineOrigin = pt;
133 | beginProjPos = projRayToLine(ori, dir, rotLineOrigin, rotLineTangent);
134 | curSelectedAxis = axis;
135 | isWorking = true;
136 | }
137 |
138 | void RotateManipulator::goOnManipulate( const QVector3D& rayOri, const QVector3D& rayDir )
139 | {
140 | M_CHECK_OBJECT(curObject)
141 |
142 | QVector3D ori = rayOri, dir = rayDir;
143 | ori = ori - curObject.data()->getCenter();
144 | ori = ori * beginMatrix;
145 | dir = dir * beginMatrix;
146 |
147 | float pos = projRayToLine(ori, dir, rotLineOrigin, rotLineTangent);
148 | float theta = (pos - beginProjPos) * 8;
149 | beginProjPos = pos;
150 |
151 | float rotAxisV[] = {0,0,0};
152 | rotAxisV[curSelectedAxis] = 1;
153 | QVector3D rotAxis = getTransform()->getRotMatrix() * QVector3D(rotAxisV[0],rotAxisV[1],rotAxisV[2]);
154 | QQuaternion q;
155 | q = QQuaternion::fromAxisAndAngle(rotAxis, theta);
156 | getTransform()->rotate(q);
157 | }
158 |
--------------------------------------------------------------------------------
/vsProject/paint3D/RotateManipulator.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "Manipulator.h"
3 | #define ROT_M_BALL_RADIUS 3
4 | #define ROT_M_BALL_SEGMENTS 32
5 | #define ROT_M_DETECT_WIDTH 0.5f
6 | #define ROT_M_BALL_WIDTH 0.1
7 | class RotateManipulator:public Manipulator
8 | {
9 | public:
10 | RotateManipulator(void);
11 | ~RotateManipulator(void);
12 |
13 | void draw(Camera& camera);
14 | char intersect(const QVector3D& rayOri, const QVector3D& rayDir);
15 | void beginManipulate(const QVector3D& rayOri, const QVector3D& rayDir, char axis);
16 | void goOnManipulate(const QVector3D& rayOri, const QVector3D& rayDir);
17 |
18 | private:
19 |
20 | void setSize(float size)
21 | {
22 | ballRadius = ROT_M_BALL_RADIUS * size;
23 | detectWidth = ROT_M_DETECT_WIDTH * size;
24 | ballWidth = ROT_M_BALL_WIDTH * size;
25 | }
26 | float ballRadius;
27 | float detectWidth;
28 | float ballWidth;
29 |
30 | float beginProjPos;
31 | QVector3D rotLineOrigin;
32 | QVector3D rotLineTangent;
33 | QMatrix4x4 beginMatrix;
34 | };
35 |
36 |
--------------------------------------------------------------------------------
/vsProject/paint3D/ScaleManipulator.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "ScaleManipulator.h"
3 |
4 |
5 | ScaleManipulator::ScaleManipulator(void)
6 | {
7 | setSize(1.0f);
8 | }
9 |
10 |
11 | ScaleManipulator::~ScaleManipulator(void)
12 | {
13 | }
14 |
15 |
16 | void ScaleManipulator::draw(Camera& camera)
17 | {
18 | if (curObject.isNull())
19 | return;
20 |
21 | QVector3D center = curObject.data()->getCenter();
22 | QVector3D delta = camera.getOrigin() - center;
23 | if (!isWorking)
24 | {
25 | setSize(delta.length() * M_SIZE_FACTOR);
26 | }
27 |
28 | glDisable(GL_LIGHTING);
29 | glDisable(GL_DEPTH_TEST);
30 | glMatrixMode(GL_MODELVIEW);
31 | glPushMatrix();
32 | glMultMatrixf(getTransform()->getTransRotMatrix().constData());
33 |
34 | glPointSize(15.0);
35 | for (char axis = 0; axis < 3; ++axis)
36 | {
37 | if (axis == curSelectedAxis)
38 | glColor3f(1,1,0);
39 | else
40 | glColor3fv(axisColor[axis]);
41 |
42 | float endPointV[] = {0,0,0};
43 | endPointV[axis] = axisLength;
44 | glLineWidth(2);
45 | glBegin(GL_LINES);
46 | glVertex3f(0,0,0);
47 | glVertex3fv(endPointV);
48 | glEnd();
49 |
50 | glBegin(GL_POINTS);
51 | glVertex3fv(endPointV);
52 | glEnd();
53 | }
54 | glPopMatrix();
55 | glEnable(GL_DEPTH_TEST);
56 | }
57 |
58 | char ScaleManipulator::intersect( const QVector3D& rayOri, const QVector3D& rayDir)
59 | {
60 | if (!curObject.isNull())
61 | {
62 | QVector3D ori = rayOri, dir = rayDir;
63 | transformRayToLocal(ori, dir);
64 | float t;
65 | for (int axis = 0; axis < 3; ++axis)
66 | {
67 | if(intersectOriginCylinder(ori, dir, axis, detectRadius, 0, axisLength,t))
68 | {
69 | return axis;
70 | }
71 | }
72 | }
73 | return -1;
74 | }
75 |
76 | void ScaleManipulator::beginManipulate( const QVector3D& rayOri, const QVector3D& rayDir , char axis)
77 | {
78 | M_CHECK_OBJECT(curObject)
79 |
80 | QVector3D ori = rayOri, dir = rayDir;
81 | transformRayToLocal(ori, dir);
82 | isWorking = true;
83 | curSelectedAxis = axis;
84 | beginProjPos = projRayToOriginAxis(ori, dir, curSelectedAxis);
85 | curScale = 1.0f;
86 | }
87 |
88 | void ScaleManipulator::goOnManipulate( const QVector3D& rayOri, const QVector3D& rayDir )
89 | {
90 | M_CHECK_OBJECT(curObject)
91 |
92 | QVector3D ori = rayOri, dir = rayDir;
93 | transformRayToLocal(ori, dir);
94 | float pos = projRayToOriginAxis(ori, dir, curSelectedAxis);
95 | curScale = 1.0f + 0.1*(pos - beginProjPos);
96 | beginProjPos = pos;
97 | curScale *= curScale;
98 | float scaleV[] = {1,1,1};
99 | scaleV[curSelectedAxis] = curScale;
100 | getTransform()->scale(QVector3D(scaleV[0],scaleV[1],scaleV[2]));
101 | }
102 |
103 |
--------------------------------------------------------------------------------
/vsProject/paint3D/ScaleManipulator.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/ScaleManipulator.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Scene.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Scene.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Scene.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Scene.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Stroke.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "Stroke.h"
3 |
4 | Stroke::Stroke(void)
5 | {
6 | }
7 |
8 | Stroke::~Stroke(void)
9 | {
10 | }
11 |
12 | float StandardStroke::getOpacity( const QVector2D& uv )
13 | {
14 | float distSq = min((uv - QVector2D(0.5,0.5)).lengthSquared() / 0.25, 1.0);
15 | return (distSq-1) / (a * distSq -1);
16 | }
17 |
18 | void StandardStroke::buildIcon()
19 | {
20 | QImage img(256, 256, QImage::Format_ARGB32);
21 | unsigned *data = (unsigned*)img.bits();
22 | for (int y = 0, ithPixel = 0; y < 256; ++y)
23 | for (int x = 0; x < 256; ++x, ++ithPixel)
24 | {
25 | QVector2D uv = QVector2D(x / 255.0f, y / 255.0f);
26 | float value = getOpacity(uv);
27 | unsigned char value255 = (1 - value) * 255;
28 | data[ithPixel] = 0xff000000 | (value255 << 16) | (value255 << 8) | (value255);
29 | }
30 |
31 | QPixmap pixImg = QPixmap::fromImage(img);
32 | icon = QIcon(pixImg);
33 | }
34 |
35 | StandardStroke::StandardStroke()
36 | {
37 | name = "Default Stroke";
38 | type = STROKE_ANALYTIC;
39 | setHardness(0.0);
40 | buildIcon();
41 | }
42 |
43 | void StandardStroke::setHardness( float hardness )
44 | {
45 | this->hardness = hardness;
46 | a = min(5 * hardness - 4,0.99999f);
47 | }
48 |
49 | EmptyStroke::EmptyStroke()
50 | {
51 | name = "Empty Stroke";
52 | type = STROKE_ANALYTIC;
53 | buildIcon();
54 | }
55 |
56 | void EmptyStroke::buildIcon()
57 | {
58 | QImage img(256, 256, QImage::Format_ARGB32);
59 | img.fill(0xff000000);
60 | QPixmap pixImg = QPixmap::fromImage(img);
61 | icon = QIcon(pixImg);
62 | }
63 |
64 | BitmapStroke::BitmapStroke(const unsigned* bitsARGB, int width, int height, const QString& name)
65 | {
66 | this->name = name;
67 | this->width = width;
68 | this->height = height;
69 | this->bits = new float[width * height];
70 | this->type = STROKE_BITMAP;
71 | for (int i = 0; i < width * height; ++i)
72 | {
73 | bits[i] = (qGray(QRgb(bitsARGB[i]))) / 255.0f;
74 | }
75 | buildIcon();
76 | }
77 |
78 | BitmapStroke::BitmapStroke( const unsigned char* bitsA, int width, int height, const QString& name )
79 | {
80 | this->name = name;
81 | this->width = width;
82 | this->height = height;
83 | this->bits = new float[width * height];
84 | this->type = STROKE_BITMAP;
85 | for (int i = 0; i < width * height; ++i)
86 | {
87 | bits[i] = bitsA[i] / 255.0f;
88 | }
89 | buildIcon();
90 | }
91 |
92 | BitmapStroke::~BitmapStroke()
93 | {
94 | if (bits)
95 | delete[] bits;
96 | }
97 |
98 | float BitmapStroke::getOpacity( const QVector2D& uv )
99 | {
100 | int x = uv.x() * (width - 1);
101 | int y = uv.y() * (height - 1);
102 | return bits[x + y * width];
103 | }
104 |
105 | void BitmapStroke::buildIcon()
106 | {
107 | QImage img(width, height, QImage::Format_ARGB32);
108 | unsigned *data = (unsigned*)img.bits();
109 | for (int y = 0, ithPixel = 0; y < height; ++y)
110 | for (int x = 0; x < width; ++x, ++ithPixel)
111 | {
112 | unsigned char value255 = (1 - bits[ithPixel]) * 255;
113 | data[ithPixel] = 0xff000000 | (value255 << 16) | (value255 << 8) | (value255);
114 | }
115 |
116 | icon = QIcon(QPixmap::fromImage(img));
117 | }
118 |
119 | StrokeLib::StrokeLib()
120 | {
121 | }
122 |
123 | bool StrokeLib::loadFromImage( const QString& fileName )
124 | {
125 | QImage img(fileName);
126 | QSharedPointer pstroke = QSharedPointer
127 | (new BitmapStroke((const unsigned*)img.bits(), img.width(), img.height(), fileName));
128 | strokes.push_back(pstroke);
129 | return true;
130 | }
131 |
132 | QSharedPointer StrokeLib::getStroke( const QString& name )
133 | {
134 | for (int i = 0; i < strokes.size(); ++i)
135 | {
136 | if (strokes[i]->getName() == name)
137 | {
138 | return strokes[i];
139 | }
140 | }
141 | return QSharedPointer();
142 | }
143 |
144 | QSharedPointer StrokeLib::getStroke( const int ithStroke )
145 | {
146 | if (ithStroke >= 0 && ithStroke < strokes.size())
147 | {
148 | return strokes[ithStroke];
149 | }
150 | return QSharedPointer();
151 | }
152 |
153 | bool StrokeLib::loadFromAbr( const QString& fileName )
154 | {
155 | QFile file(fileName);
156 | if (!file.open(QIODevice::ReadOnly))
157 | return false;
158 |
159 | QDataStream in(&file);
160 | quint16 version;
161 | in >> version;
162 | switch (version)
163 | {
164 | case 1:
165 | case 2:
166 | loadFromAbrVer12(in, version); break;
167 | case 6:
168 | loadFromAbrVer6(in, version, file); break;
169 | default:
170 | qDebug("no such version.\n");
171 | return false;
172 | }
173 | return true;
174 | }
175 |
176 | void StrokeLib::loadFromAbrVer12( QDataStream& in, quint16 version )
177 | {
178 | quint16 brushCount;
179 | in >> brushCount;
180 | for (quint16 ithBrush = 0; ithBrush < brushCount; ++ithBrush)
181 | {
182 | quint16 brushType;
183 | quint32 brushBytes;
184 | QString brushName = "brush " + QString::number(ithBrush);
185 |
186 | in >> brushType >> brushBytes;
187 | //tipo: 1 computed; 2 sampled
188 | if (brushType == 1)
189 | {
190 | if (version == 1)
191 | {
192 | in.skipRawData(14);
193 | }
194 | else
195 | {
196 | in.skipRawData(brushBytes);
197 | }
198 | }
199 | else if (brushType == 2)
200 | {
201 | quint32 miscellaneous;
202 | quint16 spacing;
203 | in >> miscellaneous >> spacing;
204 | if (version == 1)
205 | {
206 | quint8 antialias;
207 | in >> antialias;
208 | }
209 | else if (version == 2)
210 | {
211 | // override brush name
212 | quint32 nameLen;
213 | in >> nameLen;
214 | char* name = new char[nameLen * 2 + 1];
215 | in.readRawData(name, nameLen * 2 + 1);
216 | for (int i = 0; i < nameLen * 2; i+= 2)
217 | {
218 | char tmp = name[i];
219 | name[i] = name[i+1];
220 | name[i+1] = tmp;
221 | }
222 | //in.skipRawData(1);
223 | brushName = QString((QChar*)name, nameLen);
224 | delete[] name;
225 | }
226 | quint16 top, left, bottom, right, depth;
227 | quint32 ltop, lleft, lbottom, lright;
228 | quint8 compression;
229 | in >> top >> left >> bottom >> right;
230 | in >> ltop >> lleft >> lbottom >> lright;
231 | in >> depth >> compression;
232 |
233 | int br_width = lright - lleft;
234 | int br_height = lbottom - ltop;
235 |
236 | if (compression == 0)
237 | {
238 | unsigned char* rawData = new unsigned char[br_width * br_height];
239 | in.readRawData((char*)rawData, br_width * br_height);
240 | strokes.push_back(QSharedPointer(new BitmapStroke(rawData, br_width, br_height, brushName)));
241 | delete[] rawData;
242 | }
243 | else
244 | {
245 | // get length
246 | int byteForScanlines = 0;
247 | for (int i = 0; i < br_height; i++)
248 | {
249 | quint16 scanByte;
250 | in >> scanByte;
251 | byteForScanlines += scanByte;
252 | }
253 |
254 | // read compressed data and decompress it
255 | char* imgCompressa = new char[byteForScanlines];
256 | in.readRawData(imgCompressa, byteForScanlines);
257 | QVectorrawData;
258 | unpackData(imgCompressa, byteForScanlines, rawData);
259 |
260 | strokes.push_back(
261 | QSharedPointer(
262 | new BitmapStroke(&rawData[0], br_width, br_height,
263 | brushName)));
264 | }
265 | }
266 | }
267 | }
268 |
269 | void StrokeLib::loadFromAbrVer6( QDataStream& in, quint16 version , QFile& file)
270 | {
271 | int imgW = 0, imgH = 0;
272 |
273 | //difference between 6.1 and 6.2
274 | //differenza tra 6.1 e 6.2
275 | quint16 subVer;
276 | in >> subVer;
277 |
278 | in.skipRawData(8);
279 |
280 | //dimension in bytes of the sample section
281 | qint32 sampleSectionSize;
282 | in >> sampleSectionSize;
283 | int endSampleSection = sampleSectionSize+12;
284 |
285 | //loop until the end of the section
286 | for (int ithBrush = 0; file.pos() < endSampleSection - 1; ++ithBrush)
287 | {
288 | //brushSize
289 | QString brushName = "brush " + QString::number(ithBrush);
290 | quint32 brushSize;
291 | in >> brushSize;
292 |
293 | //we calculate the aim address brush that it must complementary to 4
294 | int brushEnd = brushSize;
295 | while(brushEnd%4!=0){ brushEnd++; }
296 | int complementToFourBytes = brushEnd - brushSize;
297 |
298 | // read 7 bit encoded int, which is the length of string
299 | int length = 0;
300 | for (int shift = 0; shift < 35; shift+=7)
301 | {
302 | qint8 b;
303 | in >> b;
304 | length = length | ((b&0x7f) << shift);
305 | if ((b & 0x80) == 0)
306 | break;
307 | }/*
308 | char* name = new char[length * 2 + 1];
309 | in.readRawData(name, length);
310 | brushName = QString((QChar*)name, length);
311 | delete[] name;*/
312 |
313 | in.skipRawData(length);
314 |
315 | if (subVer == 1)
316 | {
317 | quint16 top, left, bottom, right, unknown;
318 | quint32 ltop, lleft, lbottom, lright;
319 | quint8 compression;
320 | in >> top >> left >> bottom >> right;
321 | in >> ltop >> lleft >> lbottom >> lright;
322 |
323 | imgW = lright - lleft;
324 | imgH = lbottom - ltop;
325 | }
326 | else if (subVer == 2)
327 | {
328 | //skip 264 unuseful bytes
329 | /*char data[264];
330 | in.readRawData(data, 264);*/
331 | in.skipRawData(264);
332 |
333 | quint32 padHeight, padWidth, height, width;
334 | in >> padHeight >> padWidth >> height >> width;
335 |
336 | imgW = width - padWidth;
337 | imgH = height - padHeight;
338 | }
339 | quint16 depth;
340 | in >> depth;
341 |
342 | quint8 compression;
343 | in >> compression;
344 |
345 | if (compression == 0)
346 | {
347 | unsigned char* rawData = new unsigned char[imgW * imgH];
348 | in.readRawData((char*)rawData, imgW * imgH);
349 | strokes.push_back(QSharedPointer(new BitmapStroke(rawData, imgW, imgH, brushName)));
350 | delete[] rawData;
351 | }
352 | else
353 | {
354 | // get total data length
355 | int byteForScanlines = 0;
356 | for (int i = 0; i < imgH; i++)
357 | {
358 | quint16 lineLength;
359 | in >> lineLength;
360 | byteForScanlines += lineLength;
361 | }
362 |
363 | // read compressed data and decompress it
364 | char* imgCompressa = new char[byteForScanlines];
365 | in.readRawData(imgCompressa, byteForScanlines);
366 | QVector rawData;
367 | unpackData(imgCompressa, byteForScanlines, rawData);
368 |
369 |
370 | strokes.push_back(QSharedPointer(new BitmapStroke(&rawData[0], imgW, imgH, brushName)));
371 | }
372 |
373 | if (subVer == 1)
374 | {
375 | in.skipRawData(complementToFourBytes);
376 | }
377 | else if (subVer == 2)
378 | {
379 | //8 bytes finali unknown
380 | in.skipRawData(8);
381 | //skip the bytes that make complement to 4 of the size of the brush
382 | in.skipRawData(complementToFourBytes);
383 | }
384 | }
385 | }
386 |
387 | void StrokeLib::unpackData(const char* imgCompressa,
388 | int length,
389 | QVector& rawData)
390 | {
391 | int readPos = 0;
392 | rawData.clear();
393 | while (readPos < length - 1)
394 | {
395 | char count = imgCompressa[readPos++];
396 | if (count >= 0)
397 | {
398 | for (int i = 0; i < count + 1; i++)
399 | rawData.push_back(imgCompressa[readPos++]);
400 | }
401 | else
402 | {
403 | char y = imgCompressa[readPos++];
404 | for (int i = 0; i < -count + 1; i++)
405 | rawData.push_back((unsigned char)y);
406 | }
407 | }
408 | }
409 |
410 | void StrokeLib::init()
411 | {
412 | QSharedPointer pstroke = QSharedPointer(new StandardStroke);
413 | strokes.push_back(pstroke);
414 | pstroke = QSharedPointer(new EmptyStroke);
415 | strokes.push_back(pstroke);
416 | }
417 |
--------------------------------------------------------------------------------
/vsProject/paint3D/Stroke.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Stroke.h
--------------------------------------------------------------------------------
/vsProject/paint3D/TranslateManipulator.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "TranslateManipulator.h"
3 |
4 |
5 | TranslateManipulator::TranslateManipulator(void)
6 | {
7 | setSize(1.0f);
8 | }
9 |
10 |
11 | TranslateManipulator::~TranslateManipulator(void)
12 | {
13 | }
14 |
15 | void TranslateManipulator::draw(Camera& camera)
16 | {
17 | if (curObject.isNull())
18 | return;
19 |
20 | QVector3D center = curObject.data()->getCenter();
21 | QVector3D delta = camera.getOrigin() - center;
22 | if (!isWorking)
23 | {
24 | setSize(delta.length() * M_SIZE_FACTOR);
25 | }
26 | glLineWidth(2);
27 | glDisable(GL_LIGHTING);
28 | glDisable(GL_DEPTH_TEST);
29 | for (char axis = 0; axis < 3; ++axis)
30 | {
31 | if (axis == curSelectedAxis)
32 | glColor3f(1,1,0);
33 | else
34 | glColor3fv(axisColor[axis]);
35 |
36 | float centerV[] = {center.x(),center.y(),center.z()};
37 | float v[3] = {center.x(),center.y(),center.z()};
38 | v[axis] += axisLength;
39 | glBegin(GL_LINES);
40 | glVertex3fv(centerV);
41 | glVertex3fv(v);
42 | glEnd();
43 |
44 | float arrowVertex[3] = {center.x(),center.y(),center.z()};
45 | arrowVertex[axis] += arrowBegin;
46 | float arrowNormal[3];
47 | arrowNormal[axis] = 0.1f;
48 | glBegin(GL_TRIANGLE_FAN);
49 | glVertex3fv(v);
50 | for (char i = 0; i < 13; ++i)
51 | {
52 | arrowVertex[otherAxis[axis][0]] = arrowRadius * cosTable[i] + centerV[otherAxis[axis][0]];
53 | arrowVertex[otherAxis[axis][1]] = arrowRadius * sinTable[i] + centerV[otherAxis[axis][1]];
54 | glVertex3fv(arrowVertex);
55 | arrowNormal[otherAxis[axis][0]] = cosTable[i];
56 | arrowNormal[otherAxis[axis][1]] = sinTable[i];
57 | glNormal3fv(arrowNormal);
58 | }
59 | glEnd();
60 | }
61 | glEnable(GL_DEPTH_TEST);
62 | }
63 |
64 | char TranslateManipulator::intersect( const QVector3D& rayOri, const QVector3D& rayDir)
65 | {
66 | if (!curObject.isNull())
67 | {
68 | QVector3D ori = rayOri - curObject.data()->getCenter();
69 | float t;
70 | for (int axis = 0; axis < 3; ++axis)
71 | {
72 | if(intersectOriginCylinder(ori, rayDir, axis, detectRadius, 0, axisLength,t))
73 | {
74 | return axis;
75 | }
76 | }
77 | }
78 | return -1;
79 | }
80 |
81 | void TranslateManipulator::beginManipulate( const QVector3D& rayOri, const QVector3D& rayDir , char axis)
82 | {
83 | if (curObject.isNull())
84 | return;
85 |
86 | QVector3D center = curObject.data()->getCenter();
87 | isWorking = true;
88 | curSelectedAxis = axis;
89 | beginProjPos = projRayToOriginAxis(rayOri - center, rayDir, curSelectedAxis);
90 | beginCenter = center;
91 | lastPos = 0;
92 |
93 | oldTransform = curObject.data()->getTransform();
94 | }
95 |
96 | void TranslateManipulator::goOnManipulate( const QVector3D& rayOri, const QVector3D& rayDir )
97 | {
98 | M_CHECK_OBJECT(curObject)
99 |
100 | QVector3D center = curObject.data()->getCenter();
101 | float pos = projRayToOriginAxis(rayOri - beginCenter, rayDir, curSelectedAxis);
102 |
103 | float offset = pos - beginProjPos;
104 | float offsetV[] = {0,0,0};
105 | offsetV[curSelectedAxis] = offset - lastPos;
106 | lastPos = offset;
107 | getTransform()->translate(QVector3D(offsetV[0], offsetV[1], offsetV[2]));
108 | }
109 |
110 | void TranslateManipulator::setSize( float size )
111 | {
112 | axisLength = TRANS_M_AXIS_LENGTH * size;
113 | arrowBegin = TRANS_M_ARROW_BEGIN * size;
114 | arrowRadius = TRANS_M_ARROW_RADIUS * size;
115 | detectRadius = TRANS_M_DETECT_RADIUS * size;
116 | }
117 |
118 |
--------------------------------------------------------------------------------
/vsProject/paint3D/TranslateManipulator.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/TranslateManipulator.h
--------------------------------------------------------------------------------
/vsProject/paint3D/Triangle.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Triangle.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/Triangle.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/Triangle.h
--------------------------------------------------------------------------------
/vsProject/paint3D/aboutDlg.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | AboutDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 252
10 | 69
11 |
12 |
13 |
14 | About...
15 |
16 |
17 | -
18 |
19 |
20 |
21 | Times New Roman
22 | 10
23 |
24 |
25 |
26 | Paint3D v1.0
27 | Copyright(C) 2012
28 | Ouyang Yaobin
29 |
30 |
31 | Qt::AlignCenter
32 |
33 |
34 |
35 | -
36 |
37 |
38 | Qt::Horizontal
39 |
40 |
41 | QDialogButtonBox::Close
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | buttonBox
51 | rejected()
52 | AboutDialog
53 | reject()
54 |
55 |
56 | 316
57 | 260
58 |
59 |
60 | 286
61 | 274
62 |
63 |
64 |
65 |
66 | buttonBox
67 | accepted()
68 | AboutDialog
69 | accept()
70 |
71 |
72 | 248
73 | 254
74 |
75 |
76 | 157
77 | 274
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/vsProject/paint3D/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background.png
--------------------------------------------------------------------------------
/vsProject/paint3D/background_0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_0.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_1.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_2.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_3.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_4.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/background_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/background_5.jpg
--------------------------------------------------------------------------------
/vsProject/paint3D/backup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/backup.png
--------------------------------------------------------------------------------
/vsProject/paint3D/bombom.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/bombom.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/brushSetting.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | BrushSetting
4 |
5 |
6 |
7 | 0
8 | 0
9 | 329
10 | 680
11 |
12 |
13 |
14 | Brush Settings
15 |
16 |
17 | true
18 |
19 |
20 |
21 |
22 | 0
23 | 0
24 | 327
25 | 678
26 |
27 |
28 |
29 | -
30 |
31 |
32 | Brush
33 |
34 |
35 |
-
36 |
37 |
38 | Size
39 |
40 |
41 |
42 | -
43 |
44 |
45 |
46 | 0
47 | 0
48 |
49 |
50 |
51 | 5.000000000000000
52 |
53 |
54 | 0.050000000000000
55 |
56 |
57 | 1.000000000000000
58 |
59 |
60 |
61 | -
62 |
63 |
64 | Hardness
65 |
66 |
67 |
68 | -
69 |
70 |
71 | 1.000000000000000
72 |
73 |
74 | 0.000000000000000
75 |
76 |
77 |
78 | -
79 |
80 |
81 | Angle
82 |
83 |
84 |
85 | -
86 |
87 |
88 | 360.000000000000000
89 |
90 |
91 | 1.000000000000000
92 |
93 |
94 |
95 | -
96 |
97 |
98 | Ratio
99 |
100 |
101 |
102 | -
103 |
104 |
105 | 5.000000000000000
106 |
107 |
108 | 0.050000000000000
109 |
110 |
111 | 1.000000000000000
112 |
113 |
114 |
115 | -
116 |
117 |
118 | Interval
119 |
120 |
121 |
122 | -
123 |
124 |
125 | 2.000000000000000
126 |
127 |
128 | 0.050000000000000
129 |
130 |
131 | 0.060000000000000
132 |
133 |
134 |
135 | -
136 |
137 |
138 | Offset Range
139 |
140 |
141 |
142 | -
143 |
144 |
145 | 10.000000000000000
146 |
147 |
148 |
149 | -
150 |
151 |
152 | Size Jitter
153 |
154 |
155 |
156 | -
157 |
158 |
159 | -
160 |
161 |
162 | Ratio Jitter
163 |
164 |
165 |
166 | -
167 |
168 |
169 | -
170 |
171 |
172 | Angle Jitter
173 |
174 |
175 |
176 | -
177 |
178 |
179 | -
180 |
181 |
182 | Res. Ratio
183 |
184 |
185 |
186 | -
187 |
188 |
189 | 110.000000000000000
190 |
191 |
192 | 10.000000000000000
193 |
194 |
195 | 0.010000000000000
196 |
197 |
198 | 50.000000000000000
199 |
200 |
201 |
202 | -
203 |
204 |
205 | Near Plane
206 |
207 |
208 |
209 | -
210 |
211 |
212 | 0.000000000000000
213 |
214 |
215 | -5.000000000000000
216 |
217 |
218 | -1.000000000000000
219 |
220 |
221 |
222 | -
223 |
224 |
225 | Far Plane
226 |
227 |
228 |
229 | -
230 |
231 |
232 | 40.000000000000000
233 |
234 |
235 | 10.000000000000000
236 |
237 |
238 |
239 |
240 |
241 |
242 | -
243 |
244 |
245 | Stroke
246 |
247 |
248 |
249 | 2
250 |
251 |
-
252 |
253 |
-
254 |
255 |
256 | load stroke from image
257 |
258 |
259 |
260 | -
261 |
262 |
263 | load stroke from Abr
264 |
265 |
266 |
267 | -
268 |
269 |
270 | delete stroke
271 |
272 |
273 |
274 |
275 |
276 | -
277 |
278 |
279 |
280 | 0
281 | 0
282 |
283 |
284 |
285 |
286 | 0
287 | 0
288 |
289 |
290 |
291 | false
292 |
293 |
294 | QListView::ListMode
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 | SliderSpinnerGroup
307 | QWidget
308 |
309 |
310 |
311 |
312 |
313 |
314 |
--------------------------------------------------------------------------------
/vsProject/paint3D/chalk.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/chalk.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/curLayer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/curLayer.png
--------------------------------------------------------------------------------
/vsProject/paint3D/expPlane.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 28.04.2012 00:37:43
3 |
4 | newmtl wire_154185229
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.6039 0.7255 0.8980
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/fboShaderFS.glsl:
--------------------------------------------------------------------------------
1 | varying vec4 vertexF;
2 | varying vec3 normalF;
3 | varying vec4 texCoordF;
4 | uniform sampler2D baseThickTex;
5 |
6 | // the following uniform variables control depth component for output
7 |
8 | // isGeometryDepth == 1 use geometry depth (persp/ortho)
9 | // isGeometryDepth == 0 use thickness
10 | uniform float isGeometryDepth;
11 |
12 | // isPerspDepth == 1 use persp depth
13 | // isPerspDepth == 0 use ortho depth
14 | uniform float isPerspDepth;
15 |
16 | void main( void )
17 | {
18 | vec3 normal = normalize(normalF);
19 | float thickness = texture2D(baseThickTex,texCoordF.xy).w;
20 | float geoDepth = length(vertexF.xyz) * isPerspDepth + (-vertexF.z) * (1.0 - isPerspDepth);
21 | float l = isGeometryDepth * geoDepth + (1.0 - isGeometryDepth) * thickness;
22 | float depth = l / (l + 1.0);
23 | vec3 nor = (normal + vec3(1.0,1.0,1.0)) / 2.0;
24 |
25 | float faceID = texCoordF.w;
26 | float faceID_H = floor(faceID / 65536.0);
27 | float faceID_L = faceID - faceID_H * 65536.0;
28 | float objectID = texCoordF.z;
29 |
30 | float texZ = faceID_L / 65535.0;
31 | float texW = (objectID * 256.0 + faceID_H) / 65535.0;
32 |
33 | gl_FragData[0] = vec4(texCoordF.xy, texZ, texW);
34 | gl_FragData[1] = vec4(nor.xyz, depth);
35 | }
--------------------------------------------------------------------------------
/vsProject/paint3D/fboShaderVS.glsl:
--------------------------------------------------------------------------------
1 | attribute vec4 vertexV;
2 | attribute vec3 normalV;
3 | attribute vec4 texCoordV;
4 |
5 | varying vec4 vertexF;
6 | varying vec3 normalF;
7 | varying vec4 texCoordF;
8 |
9 | void main( void )
10 | {
11 | gl_Position =gl_ModelViewProjectionMatrix * vertexV;
12 | vertexF = gl_ModelViewMatrix * vertexV;
13 | //normalF = normalV;
14 | normalF = gl_NormalMatrix * normalV;
15 | texCoordF = texCoordV;
16 | }
--------------------------------------------------------------------------------
/vsProject/paint3D/glew-2.1.0/lib/Release/Win32/glew32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/glew-2.1.0/lib/Release/Win32/glew32.lib
--------------------------------------------------------------------------------
/vsProject/paint3D/glew-2.1.0/lib/Release/Win32/glew32s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/glew-2.1.0/lib/Release/Win32/glew32s.lib
--------------------------------------------------------------------------------
/vsProject/paint3D/glew-2.1.0/lib/Release/x64/glew32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/glew-2.1.0/lib/Release/x64/glew32.lib
--------------------------------------------------------------------------------
/vsProject/paint3D/glew-2.1.0/lib/Release/x64/glew32s.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/glew-2.1.0/lib/Release/x64/glew32s.lib
--------------------------------------------------------------------------------
/vsProject/paint3D/glew32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/glew32.dll
--------------------------------------------------------------------------------
/vsProject/paint3D/glextensions.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
6 | **
7 | ** This file is part of the demonstration applications of the Qt Toolkit.
8 | **
9 | ** $QT_BEGIN_LICENSE:LGPL$
10 | ** Commercial Usage
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
12 | ** accordance with the Qt Commercial License Agreement provided with the
13 | ** Software or, alternatively, in accordance with the terms contained in
14 | ** a written agreement between you and Nokia.
15 | **
16 | ** GNU Lesser General Public License Usage
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
18 | ** General Public License version 2.1 as published by the Free Software
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
20 | ** packaging of this file. Please review the following information to
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 | **
24 | ** In addition, as a special exception, Nokia gives you certain additional
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 | **
28 | ** GNU General Public License Usage
29 | ** Alternatively, this file may be used under the terms of the GNU
30 | ** General Public License version 3.0 as published by the Free Software
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
32 | ** packaging of this file. Please review the following information to
33 | ** ensure the GNU General Public License version 3.0 requirements will be
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
35 | **
36 | ** If you have questions regarding the use of this file, please contact
37 | ** Nokia at qt-info@nokia.com.
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include "glextensions.h"
43 |
44 | #define RESOLVE_GL_FUNC(f) ok &= bool((f = (_gl##f) context->getProcAddress(QLatin1String("gl" #f))));
45 |
46 | bool GLExtensionFunctions::resolve(const QGLContext *context)
47 | {
48 | bool ok = true;
49 |
50 | RESOLVE_GL_FUNC(GenFramebuffersEXT)
51 | RESOLVE_GL_FUNC(GenRenderbuffersEXT)
52 | RESOLVE_GL_FUNC(BindRenderbufferEXT)
53 | RESOLVE_GL_FUNC(RenderbufferStorageEXT)
54 | RESOLVE_GL_FUNC(DeleteFramebuffersEXT)
55 | RESOLVE_GL_FUNC(DeleteRenderbuffersEXT)
56 | RESOLVE_GL_FUNC(BindFramebufferEXT)
57 | RESOLVE_GL_FUNC(FramebufferTexture2DEXT)
58 | RESOLVE_GL_FUNC(FramebufferRenderbufferEXT)
59 | RESOLVE_GL_FUNC(CheckFramebufferStatusEXT)
60 |
61 | RESOLVE_GL_FUNC(ActiveTexture)
62 | RESOLVE_GL_FUNC(TexImage3D)
63 |
64 | RESOLVE_GL_FUNC(GenBuffers)
65 | RESOLVE_GL_FUNC(BindBuffer)
66 | RESOLVE_GL_FUNC(BufferData)
67 | RESOLVE_GL_FUNC(DeleteBuffers)
68 | RESOLVE_GL_FUNC(MapBuffer)
69 | RESOLVE_GL_FUNC(UnmapBuffer)
70 |
71 | return ok;
72 | }
73 |
74 | bool GLExtensionFunctions::fboSupported() {
75 | return GenFramebuffersEXT
76 | && GenRenderbuffersEXT
77 | && BindRenderbufferEXT
78 | && RenderbufferStorageEXT
79 | && DeleteFramebuffersEXT
80 | && DeleteRenderbuffersEXT
81 | && BindFramebufferEXT
82 | && FramebufferTexture2DEXT
83 | && FramebufferRenderbufferEXT
84 | && CheckFramebufferStatusEXT;
85 | }
86 |
87 | bool GLExtensionFunctions::openGL15Supported() {
88 | return ActiveTexture
89 | && TexImage3D
90 | && GenBuffers
91 | && BindBuffer
92 | && BufferData
93 | && DeleteBuffers
94 | && MapBuffer
95 | && UnmapBuffer;
96 | }
97 |
98 | #undef RESOLVE_GL_FUNC
99 |
--------------------------------------------------------------------------------
/vsProject/paint3D/glextensions.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 | ** All rights reserved.
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
6 | **
7 | ** This file is part of the demonstration applications of the Qt Toolkit.
8 | **
9 | ** $QT_BEGIN_LICENSE:LGPL$
10 | ** Commercial Usage
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
12 | ** accordance with the Qt Commercial License Agreement provided with the
13 | ** Software or, alternatively, in accordance with the terms contained in
14 | ** a written agreement between you and Nokia.
15 | **
16 | ** GNU Lesser General Public License Usage
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
18 | ** General Public License version 2.1 as published by the Free Software
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
20 | ** packaging of this file. Please review the following information to
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 | **
24 | ** In addition, as a special exception, Nokia gives you certain additional
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27 | **
28 | ** GNU General Public License Usage
29 | ** Alternatively, this file may be used under the terms of the GNU
30 | ** General Public License version 3.0 as published by the Free Software
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
32 | ** packaging of this file. Please review the following information to
33 | ** ensure the GNU General Public License version 3.0 requirements will be
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
35 | **
36 | ** If you have questions regarding the use of this file, please contact
37 | ** Nokia at qt-info@nokia.com.
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef GLEXTENSIONS_H
43 | #define GLEXTENSIONS_H
44 |
45 | #include
46 |
47 | /*
48 | Functions resolved:
49 |
50 | glGenFramebuffersEXT
51 | glGenRenderbuffersEXT
52 | glBindRenderbufferEXT
53 | glRenderbufferStorageEXT
54 | glDeleteFramebuffersEXT
55 | glDeleteRenderbuffersEXT
56 | glBindFramebufferEXT
57 | glFramebufferTexture2DEXT
58 | glFramebufferRenderbufferEXT
59 | glCheckFramebufferStatusEXT
60 |
61 | glActiveTexture
62 | glTexImage3D
63 |
64 | glGenBuffers
65 | glBindBuffer
66 | glBufferData
67 | glDeleteBuffers
68 | glMapBuffer
69 | glUnmapBuffer
70 | */
71 |
72 | #ifndef Q_WS_MAC
73 | # ifndef APIENTRYP
74 | # ifdef APIENTRY
75 | # define APIENTRYP APIENTRY *
76 | # else
77 | # define APIENTRY
78 | # define APIENTRYP *
79 | # endif
80 | # endif
81 | #else
82 | # define APIENTRY
83 | # define APIENTRYP *
84 | #endif
85 |
86 | #ifndef GL_VERSION_1_2
87 | #define GL_TEXTURE_3D 0x806F
88 | #define GL_TEXTURE_WRAP_R 0x8072
89 | #define GL_CLAMP_TO_EDGE 0x812F
90 | #define GL_BGRA 0x80E1
91 | #endif
92 |
93 | #ifndef GL_VERSION_1_3
94 | #define GL_TEXTURE0 0x84C0
95 | #define GL_TEXTURE1 0x84C1
96 | #define GL_TEXTURE2 0x84C2
97 | #define GL_TEXTURE_CUBE_MAP 0x8513
98 | #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
99 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
100 | //#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
101 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
102 | //#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
103 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
104 | #endif
105 |
106 | #ifndef GL_ARB_vertex_buffer_object
107 | typedef ptrdiff_t GLsizeiptrARB;
108 | #endif
109 |
110 | #ifndef GL_VERSION_1_5
111 | #define GL_ARRAY_BUFFER 0x8892
112 | #define GL_ELEMENT_ARRAY_BUFFER 0x8893
113 | #define GL_READ_WRITE 0x88BA
114 | #define GL_STATIC_DRAW 0x88E4
115 | #endif
116 |
117 | #ifndef GL_EXT_framebuffer_object
118 | #define GL_RENDERBUFFER_EXT 0x8D41
119 | #define GL_FRAMEBUFFER_EXT 0x8D40
120 | #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
121 | #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
122 | #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
123 | #endif
124 |
125 | typedef void (APIENTRY *_glGenFramebuffersEXT) (GLsizei, GLuint *);
126 | typedef void (APIENTRY *_glGenRenderbuffersEXT) (GLsizei, GLuint *);
127 | typedef void (APIENTRY *_glBindRenderbufferEXT) (GLenum, GLuint);
128 | typedef void (APIENTRY *_glRenderbufferStorageEXT) (GLenum, GLenum, GLsizei, GLsizei);
129 | typedef void (APIENTRY *_glDeleteFramebuffersEXT) (GLsizei, const GLuint*);
130 | typedef void (APIENTRY *_glDeleteRenderbuffersEXT) (GLsizei, const GLuint*);
131 | typedef void (APIENTRY *_glBindFramebufferEXT) (GLenum, GLuint);
132 | typedef void (APIENTRY *_glFramebufferTexture2DEXT) (GLenum, GLenum, GLenum, GLuint, GLint);
133 | typedef void (APIENTRY *_glFramebufferRenderbufferEXT) (GLenum, GLenum, GLenum, GLuint);
134 | typedef GLenum (APIENTRY *_glCheckFramebufferStatusEXT) (GLenum);
135 |
136 | typedef void (APIENTRY *_glActiveTexture) (GLenum);
137 | typedef void (APIENTRY *_glTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
138 |
139 | typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *);
140 | typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint);
141 | typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
142 | typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *);
143 | typedef void *(APIENTRY *_glMapBuffer) (GLenum, GLenum);
144 | typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum);
145 |
146 | struct GLExtensionFunctions
147 | {
148 | bool resolve(const QGLContext *context);
149 |
150 | bool fboSupported();
151 | bool openGL15Supported(); // the rest: multi-texture, 3D-texture, vertex buffer objects
152 |
153 | _glGenFramebuffersEXT GenFramebuffersEXT;
154 | _glGenRenderbuffersEXT GenRenderbuffersEXT;
155 | _glBindRenderbufferEXT BindRenderbufferEXT;
156 | _glRenderbufferStorageEXT RenderbufferStorageEXT;
157 | _glDeleteFramebuffersEXT DeleteFramebuffersEXT;
158 | _glDeleteRenderbuffersEXT DeleteRenderbuffersEXT;
159 | _glBindFramebufferEXT BindFramebufferEXT;
160 | _glFramebufferTexture2DEXT FramebufferTexture2DEXT;
161 | _glFramebufferRenderbufferEXT FramebufferRenderbufferEXT;
162 | _glCheckFramebufferStatusEXT CheckFramebufferStatusEXT;
163 |
164 | _glActiveTexture ActiveTexture;
165 | _glTexImage3D TexImage3D;
166 |
167 | _glGenBuffers GenBuffers;
168 | _glBindBuffer BindBuffer;
169 | _glBufferData BufferData;
170 | _glDeleteBuffers DeleteBuffers;
171 | _glMapBuffer MapBuffer;
172 | _glUnmapBuffer UnmapBuffer;
173 | };
174 |
175 | inline GLExtensionFunctions &getGLExtensionFunctions()
176 | {
177 | static GLExtensionFunctions funcs;
178 | return funcs;
179 | }
180 |
181 | #define glGenFramebuffersEXT getGLExtensionFunctions().GenFramebuffersEXT
182 | #define glGenRenderbuffersEXT getGLExtensionFunctions().GenRenderbuffersEXT
183 | #define glBindRenderbufferEXT getGLExtensionFunctions().BindRenderbufferEXT
184 | #define glRenderbufferStorageEXT getGLExtensionFunctions().RenderbufferStorageEXT
185 | #define glDeleteFramebuffersEXT getGLExtensionFunctions().DeleteFramebuffersEXT
186 | #define glDeleteRenderbuffersEXT getGLExtensionFunctions().DeleteRenderbuffersEXT
187 | #define glBindFramebufferEXT getGLExtensionFunctions().BindFramebufferEXT
188 | #define glFramebufferTexture2DEXT getGLExtensionFunctions().FramebufferTexture2DEXT
189 | #define glFramebufferRenderbufferEXT getGLExtensionFunctions().FramebufferRenderbufferEXT
190 | #define glCheckFramebufferStatusEXT getGLExtensionFunctions().CheckFramebufferStatusEXT
191 |
192 | #define glActiveTexture getGLExtensionFunctions().ActiveTexture
193 | #define glTexImage3D getGLExtensionFunctions().TexImage3D
194 |
195 | #define glGenBuffers getGLExtensionFunctions().GenBuffers
196 | #define glBindBuffer getGLExtensionFunctions().BindBuffer
197 | #define glBufferData getGLExtensionFunctions().BufferData
198 | #define glDeleteBuffers getGLExtensionFunctions().DeleteBuffers
199 | #define glMapBuffer getGLExtensionFunctions().MapBuffer
200 | #define glUnmapBuffer getGLExtensionFunctions().UnmapBuffer
201 |
202 | #endif
203 |
--------------------------------------------------------------------------------
/vsProject/paint3D/history.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | History
4 |
5 |
6 |
7 | 0
8 | 0
9 | 306
10 | 235
11 |
12 |
13 |
14 | History
15 |
16 |
17 | -
18 |
19 |
20 |
21 |
22 |
23 |
24 | QUndoView
25 | QListView
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/vsProject/paint3D/knot.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 13.05.2012 23:48:18
3 |
4 | newmtl wire_087225087
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.3412 0.8824 0.3412
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/knot.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/knot.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/knotNew.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/knotNew.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/knotNew2.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/knotNew2.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/main.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "paint3dframe.h"
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | //QDir::setCurrent(QCoreApplication::applicationDirPath ());
9 | //qDebug()<load("paint3d_zh.qm");
12 | a.installTranslator(translator);
13 | Paint3DFrame* app = Paint3DFrame::getInstance();
14 | app->initialize();
15 | app->show();
16 | return a.exec();
17 | }
18 |
--------------------------------------------------------------------------------
/vsProject/paint3D/mainWindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 616
10 | 571
11 |
12 |
13 |
14 | true
15 |
16 |
17 | Qt::ClickFocus
18 |
19 |
20 | Paint3D
21 |
22 |
23 |
24 | :/paint3D/Resources/software.png:/paint3D/Resources/software.png
25 |
26 |
27 | false
28 |
29 |
30 | QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks
31 |
32 |
33 |
92 |
93 |
94 |
95 | toolBar
96 |
97 |
98 | TopToolBarArea
99 |
100 |
101 | false
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | true
111 |
112 |
113 | Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea
114 |
115 |
116 | Object
117 |
118 |
119 | 2
120 |
121 |
122 |
123 | false
124 |
125 |
126 |
127 |
128 |
129 | toolBar_2
130 |
131 |
132 | TopToolBarArea
133 |
134 |
135 | false
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | false
151 |
152 |
153 | Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea
154 |
155 |
156 | History
157 |
158 |
159 | 2
160 |
161 |
162 |
163 |
164 |
165 | Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea
166 |
167 |
168 | Material Layer
169 |
170 |
171 | 2
172 |
173 |
174 |
175 |
176 |
177 | true
178 |
179 |
180 | Qt::AllDockWidgetAreas
181 |
182 |
183 | Paint
184 |
185 |
186 | 1
187 |
188 |
189 |
190 | false
191 |
192 |
193 |
194 |
195 |
196 | toolBar
197 |
198 |
199 | TopToolBarArea
200 |
201 |
202 | false
203 |
204 |
205 |
206 |
207 |
208 |
209 | true
210 |
211 |
212 | QDockWidget::AllDockWidgetFeatures
213 |
214 |
215 | Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea
216 |
217 |
218 | Brush
219 |
220 |
221 | 1
222 |
223 |
224 |
225 |
226 |
227 |
228 | :/paint3D/Resources/import.png:/paint3D/Resources/import.png
229 |
230 |
231 | Import Model
232 |
233 |
234 | Import a 3d Model
235 |
236 |
237 | Ctrl+I
238 |
239 |
240 |
241 |
242 |
243 | :/paint3D/Resources/new.png:/paint3D/Resources/new.png
244 |
245 |
246 | New
247 |
248 |
249 | Create a New File
250 |
251 |
252 | Ctrl+N
253 |
254 |
255 |
256 |
257 |
258 | :/paint3D/Resources/open.png:/paint3D/Resources/open.png
259 |
260 |
261 | Open
262 |
263 |
264 | Open a File
265 |
266 |
267 | Ctrl+O
268 |
269 |
270 |
271 |
272 |
273 | :/paint3D/Resources/save.png:/paint3D/Resources/save.png
274 |
275 |
276 | Save
277 |
278 |
279 | Save File
280 |
281 |
282 | Ctrl+S
283 |
284 |
285 |
286 |
287 | true
288 |
289 |
290 |
291 | :/paint3D/Resources/move.png:/paint3D/Resources/move.png
292 |
293 |
294 | Move
295 |
296 |
297 | Move Object
298 |
299 |
300 | W
301 |
302 |
303 |
304 |
305 | true
306 |
307 |
308 |
309 | :/paint3D/Resources/rotate.png:/paint3D/Resources/rotate.png
310 |
311 |
312 | Rotate
313 |
314 |
315 | Rotate Object
316 |
317 |
318 | E
319 |
320 |
321 |
322 |
323 | true
324 |
325 |
326 |
327 | :/paint3D/Resources/scale.png:/paint3D/Resources/scale.png
328 |
329 |
330 | Scale
331 |
332 |
333 | Scale Object
334 |
335 |
336 | R
337 |
338 |
339 |
340 |
341 | true
342 |
343 |
344 |
345 | :/paint3D/Resources/select.png:/paint3D/Resources/select.png
346 |
347 |
348 | Select
349 |
350 |
351 | Select Object
352 |
353 |
354 | Q
355 |
356 |
357 |
358 |
359 |
360 | :/paint3D/Resources/focus.png:/paint3D/Resources/focus.png
361 |
362 |
363 | Focus Model
364 |
365 |
366 | Focus Selected Model
367 |
368 |
369 | F
370 |
371 |
372 |
373 |
374 | true
375 |
376 |
377 |
378 | :/paint3D/Resources/brush.png:/paint3D/Resources/brush.png
379 |
380 |
381 | Paint
382 |
383 |
384 | Paint Model
385 |
386 |
387 | B
388 |
389 |
390 |
391 |
392 |
393 | :/paint3D/Resources/planeLocator .png:/paint3D/Resources/planeLocator .png
394 |
395 |
396 | Create Plane Locator
397 |
398 |
399 | create a plane locator
400 |
401 |
402 |
403 |
404 | true
405 |
406 |
407 |
408 | :/paint3D/Resources/selectFace.png:/paint3D/Resources/selectFace.png
409 |
410 |
411 | Select Face
412 |
413 |
414 | Select Face
415 |
416 |
417 | A
418 |
419 |
420 |
421 |
422 | About...
423 |
424 |
425 |
426 |
427 |
428 |
429 | GLViewWidget
430 | QWidget
431 |
432 | 1
433 |
434 |
435 | BrushSettingWidget
436 | QWidget
437 |
438 | 1
439 |
440 |
441 | HistoryWidget
442 | QWidget
443 |
444 | 1
445 |
446 |
447 | MaterialLayerWidget
448 | QWidget
449 |
450 | 1
451 |
452 |
453 | PaintSettingWidget
454 | QWidget
455 |
456 | 1
457 |
458 |
459 | ObjectTransformWidget
460 | QWidget
461 |
462 | 1
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
--------------------------------------------------------------------------------
/vsProject/paint3D/materialLayer.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MaterialLayer
4 |
5 |
6 |
7 | 0
8 | 0
9 | 409
10 | 523
11 |
12 |
13 |
14 | Layer
15 |
16 |
17 | true
18 |
19 |
20 |
21 |
22 | 0
23 | 0
24 | 407
25 | 521
26 |
27 |
28 |
29 | -
30 |
31 |
32 |
33 | 8
34 |
35 |
36 |
37 | false
38 |
39 |
40 | QAbstractItemView::SelectRows
41 |
42 |
43 | QListView::ListMode
44 |
45 |
46 | true
47 |
48 |
49 |
50 | -
51 |
52 |
-
53 |
54 |
55 | Add Layer
56 |
57 |
58 |
59 | -
60 |
61 |
62 | Delete Layer
63 |
64 |
65 |
66 | -
67 |
68 |
69 | Move Up
70 |
71 |
72 |
73 | -
74 |
75 |
76 | Move Down
77 |
78 |
79 |
80 |
81 |
82 | -
83 |
84 |
85 | Channel
86 |
87 |
88 |
-
89 |
90 |
91 | Color
92 |
93 |
94 | true
95 |
96 |
97 |
98 | -
99 |
100 |
101 | Reflection
102 |
103 |
104 |
105 | -
106 |
107 |
108 | Glossness
109 |
110 |
111 |
112 | -
113 |
114 |
115 | Refraction
116 |
117 |
118 |
119 | -
120 |
121 |
122 | IOR
123 |
124 |
125 |
126 | -
127 |
128 |
129 | Thickness
130 |
131 |
132 |
133 | -
134 |
135 |
-
136 |
137 |
138 | Import Image to Layer
139 |
140 |
141 |
142 | -
143 |
144 |
145 | Export Layer to Image
146 |
147 |
148 |
149 |
150 |
151 | -
152 |
153 |
154 | Export Canvas to Image
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/vsProject/paint3D/mountain.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 25.04.2012 19:29:08
3 |
4 | newmtl wire_027177148
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.1059 0.6941 0.5804
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/myapp.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/myapp.ico
--------------------------------------------------------------------------------
/vsProject/paint3D/object.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TransformEditor
4 |
5 |
6 |
7 | 0
8 | 0
9 | 319
10 | 154
11 |
12 |
13 |
14 | Object Transform
15 |
16 |
17 | true
18 |
19 |
20 |
21 |
22 | 0
23 | 0
24 | 324
25 | 136
26 |
27 |
28 |
29 | -
30 |
31 |
32 | Name
33 |
34 |
35 |
36 | -
37 |
38 |
39 | -
40 |
41 |
42 | Translate
43 |
44 |
45 |
46 | -
47 |
48 |
49 | -10000.000000000000000
50 |
51 |
52 | 10000.000000000000000
53 |
54 |
55 | 0.100000000000000
56 |
57 |
58 |
59 | -
60 |
61 |
62 | -10000.000000000000000
63 |
64 |
65 | 10000.000000000000000
66 |
67 |
68 | 0.100000000000000
69 |
70 |
71 |
72 | -
73 |
74 |
75 | -10000.000000000000000
76 |
77 |
78 | 10000.000000000000000
79 |
80 |
81 | 0.100000000000000
82 |
83 |
84 |
85 | -
86 |
87 |
88 | Rotate
89 |
90 |
91 |
92 | -
93 |
94 |
95 | -180.000000000000000
96 |
97 |
98 | 180.000000000000000
99 |
100 |
101 |
102 | -
103 |
104 |
105 | -180.000000000000000
106 |
107 |
108 | 180.000000000000000
109 |
110 |
111 |
112 | -
113 |
114 |
115 | -180.000000000000000
116 |
117 |
118 | 180.000000000000000
119 |
120 |
121 |
122 | -
123 |
124 |
125 | Scale
126 |
127 |
128 |
129 | -
130 |
131 |
132 | 0.010000000000000
133 |
134 |
135 | 10000.000000000000000
136 |
137 |
138 | 0.010000000000000
139 |
140 |
141 | 1.000000000000000
142 |
143 |
144 |
145 | -
146 |
147 |
148 | 0.010000000000000
149 |
150 |
151 | 10000.000000000000000
152 |
153 |
154 | 0.010000000000000
155 |
156 |
157 | 1.000000000000000
158 |
159 |
160 |
161 | -
162 |
163 |
164 | 0.010000000000000
165 |
166 |
167 | 10000.000000000000000
168 |
169 |
170 | 0.010000000000000
171 |
172 |
173 | 1.000000000000000
174 |
175 |
176 |
177 | -
178 |
179 |
180 | Qt::Vertical
181 |
182 |
183 |
184 | 20
185 | 11
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/vsProject/paint3D/paint3D.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {2a3770e4-a4ac-424b-b834-30c8868d4339}
6 |
7 |
8 | {f63a5ea5-01a8-4899-8a6b-704ca5d0827a}
9 |
10 |
11 | {8799d25b-9b9d-45c3-b35e-42687bc1e8d7}
12 |
13 |
14 | {9da9e9c7-5c6b-45b7-b2c1-3dad91b91298}
15 |
16 |
17 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
18 | h
19 |
20 |
21 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
22 | ui
23 |
24 |
25 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
26 | qrc;*
27 | false
28 |
29 |
30 | {7058ee62-5e47-45b3-bc7a-6b3edc7949ef}
31 |
32 |
33 | {6bf73d2f-2e6c-418e-b820-368ea8a56e1d}
34 |
35 |
36 | {71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}
37 | moc;h;cpp
38 |
39 |
40 | {62861f8a-66da-4022-817a-ab0cbf6af8d1}
41 | cpp;moc
42 | False
43 |
44 |
45 | {dfb28147-30d8-4f8a-b873-91d6fcd243d8}
46 | cpp;moc
47 | False
48 |
49 |
50 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
51 | qrc;*
52 | false
53 |
54 |
55 | {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}
56 | ts
57 | false
58 |
59 |
60 | {617587be-2bc0-4197-bf1f-c682243d0b09}
61 |
62 |
63 |
64 |
65 | 系统
66 |
67 |
68 | 系统\操纵器
69 |
70 |
71 | 系统\操纵器
72 |
73 |
74 | 系统\操纵器
75 |
76 |
77 | 系统\操纵器
78 |
79 |
80 | 系统\画笔画布
81 |
82 |
83 | 系统\画笔画布
84 |
85 |
86 | 系统\画笔画布
87 |
88 |
89 | 系统\画笔画布
90 |
91 |
92 | 系统\画笔画布
93 |
94 |
95 | 系统\画笔画布
96 |
97 |
98 | 系统\场景
99 |
100 |
101 | 系统\场景
102 |
103 |
104 | 系统\场景
105 |
106 |
107 | 系统\场景
108 |
109 |
110 | 系统\场景
111 |
112 |
113 | 系统\场景
114 |
115 |
116 | 系统\场景
117 |
118 |
119 | 系统\场景
120 |
121 |
122 | 预编译头
123 |
124 |
125 | 界面
126 |
127 |
128 | 界面
129 |
130 |
131 | 界面
132 |
133 |
134 | 界面
135 |
136 |
137 | 界面
138 |
139 |
140 | 界面
141 |
142 |
143 | 界面
144 |
145 |
146 | 界面\自定义控件
147 |
148 |
149 | 界面\自定义控件
150 |
151 |
152 | 界面\自定义控件
153 |
154 |
155 | Generated Files
156 |
157 |
158 | Generated Files\Release
159 |
160 |
161 | Generated Files\Release
162 |
163 |
164 | Generated Files\Release
165 |
166 |
167 | Generated Files\Release
168 |
169 |
170 | Generated Files\Release
171 |
172 |
173 | Generated Files\Release
174 |
175 |
176 | Generated Files\Release
177 |
178 |
179 | Generated Files\Release
180 |
181 |
182 | Generated Files\Release
183 |
184 |
185 | Generated Files\Release
186 |
187 |
188 | Generated Files\Debug
189 |
190 |
191 | Generated Files\Debug
192 |
193 |
194 | Generated Files\Debug
195 |
196 |
197 | Generated Files\Debug
198 |
199 |
200 | Generated Files\Debug
201 |
202 |
203 | Generated Files\Debug
204 |
205 |
206 | Generated Files\Debug
207 |
208 |
209 | Generated Files\Debug
210 |
211 |
212 | Generated Files\Debug
213 |
214 |
215 | Generated Files\Debug
216 |
217 |
218 | Generated Files
219 |
220 |
221 | 系统\场景
222 |
223 |
224 |
225 |
226 | 系统\操纵器
227 |
228 |
229 | 系统\操纵器
230 |
231 |
232 | 系统\操纵器
233 |
234 |
235 | 系统\操纵器
236 |
237 |
238 | 系统\画笔画布
239 |
240 |
241 | 系统\画笔画布
242 |
243 |
244 | 系统\画笔画布
245 |
246 |
247 | 系统\画笔画布
248 |
249 |
250 | 系统\场景
251 |
252 |
253 | 系统\场景
254 |
255 |
256 | 系统\场景
257 |
258 |
259 | 系统\场景
260 |
261 |
262 | 系统\场景
263 |
264 |
265 | 系统\场景
266 |
267 |
268 | 系统\场景
269 |
270 |
271 | 系统\场景
272 |
273 |
274 | 预编译头
275 |
276 |
277 | 界面\自定义控件
278 |
279 |
280 | Generated Files
281 |
282 |
283 | Generated Files
284 |
285 |
286 | Generated Files
287 |
288 |
289 | Generated Files
290 |
291 |
292 | Generated Files
293 |
294 |
295 | Generated Files
296 |
297 |
298 | Generated Files
299 |
300 |
301 | 系统\场景
302 |
303 |
304 |
305 |
306 | Resource Files
307 |
308 |
309 | Translation Files
310 |
311 |
312 |
313 | 系统\Shader
314 |
315 |
316 | 系统\Shader
317 |
318 |
319 | 系统\Shader
320 |
321 |
322 | 系统\Shader
323 |
324 |
325 |
326 |
327 | Resource Files
328 |
329 |
330 | Resource Files
331 |
332 |
333 | Resource Files
334 |
335 |
336 | Resource Files
337 |
338 |
339 | Resource Files
340 |
341 |
342 | Resource Files
343 |
344 |
345 | Resource Files
346 |
347 |
348 | Resource Files
349 |
350 |
351 | Resource Files
352 |
353 |
354 | Resource Files
355 |
356 |
357 | Resource Files
358 |
359 |
360 | Resource Files
361 |
362 |
363 | Resource Files
364 |
365 |
366 | Resource Files
367 |
368 |
369 | Resource Files
370 |
371 |
372 | Resource Files
373 |
374 |
375 | Resource Files
376 |
377 |
378 | Resource Files
379 |
380 |
381 | Resource Files
382 |
383 |
384 | Resource Files
385 |
386 |
387 | Resource Files
388 |
389 |
390 | Resource Files
391 |
392 |
393 | Resource Files
394 |
395 |
396 | Resource Files
397 |
398 |
399 |
400 |
401 | Resource Files
402 |
403 |
404 |
405 |
406 | 系统
407 |
408 |
409 | 系统\画笔画布
410 |
411 |
412 | 系统\画笔画布
413 |
414 |
415 | Qt界面文件
416 |
417 |
418 | Qt界面文件
419 |
420 |
421 | Qt界面文件
422 |
423 |
424 | Qt界面文件
425 |
426 |
427 | Qt界面文件
428 |
429 |
430 | Qt界面文件
431 |
432 |
433 | Qt界面文件
434 |
435 |
436 | Qt界面文件\资源文件
437 |
438 |
439 | 界面
440 |
441 |
442 | 界面
443 |
444 |
445 | 界面
446 |
447 |
448 | 界面
449 |
450 |
451 | 界面
452 |
453 |
454 | 界面
455 |
456 |
457 | 界面
458 |
459 |
460 | 界面\自定义控件
461 |
462 |
463 | 界面\自定义控件
464 |
465 |
466 |
--------------------------------------------------------------------------------
/vsProject/paint3D/paint3d.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Resources/software.png
4 | Resources/selectFace.png
5 | Resources/planeLocator .png
6 | Resources/brush.png
7 | Resources/null.png
8 | Resources/minus.png
9 | Resources/plus.png
10 | Resources/undo.png
11 | Resources/paint.png
12 | Resources/focus.png
13 | Resources/select.png
14 | Resources/scale.png
15 | Resources/move.png
16 | Resources/import.png
17 | Resources/redo.png
18 | Resources/copy.png
19 | Resources/rotate.png
20 | Resources/cut.png
21 | Resources/new.png
22 | Resources/open.png
23 | Resources/paste.png
24 | Resources/save.png
25 |
26 |
27 |
--------------------------------------------------------------------------------
/vsProject/paint3D/paint3d_zh.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/paint3d_zh.qm
--------------------------------------------------------------------------------
/vsProject/paint3D/plane.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 14.05.2012 17:00:36
3 |
4 | newmtl wire_113135006
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.4431 0.5294 0.0235
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/sceneShaderFS.glsl:
--------------------------------------------------------------------------------
1 | uniform vec3 viewLightDir;
2 | uniform sampler2D colorTex; // r g b a
3 | uniform sampler2D surfTex; // reflLevel, reflGlossness, refrLevel, fresnelIOR
4 | uniform sampler2D thickTex; // thickness
5 | uniform samplerCube envTex; // environment map
6 | uniform sampler2D brdfLUT;
7 | uniform mat4 viewMatrixTranspose;// matrix converting normal from view space to world space
8 | uniform float finalAlpha; // final alpha used for blending
9 |
10 | varying vec4 vertexF;
11 | varying vec3 normalF;
12 | varying vec3 tangentF;
13 | varying vec3 bitangentF;
14 | varying vec4 texCoordF;
15 |
16 | #define ENV_MIP_LEVELS 7
17 | vec3 fresnelSchlickRoughness(float cosTheta, vec3 F0, float roughness)
18 | {
19 | return F0 + (max(vec3(1.0 - roughness), F0) - F0) * pow(1.0 - cosTheta, 5.0);
20 | }
21 |
22 | void main(void)
23 | {
24 | vec3 normal = normalize(normalF);
25 | vec3 lightDir = normalize(vec3(0.5, 0.5, 1.0));
26 | vec3 viewDir = normalize(-vertexF.xyz);
27 |
28 | // compute view direction in tangent space
29 | vec3 TCrossB = cross(tangentF, bitangentF);
30 | vec3 NCrossV = cross(normal, viewDir);
31 | float det = dot(TCrossB, normal);
32 | vec2 viewDir_UV = vec2(dot(NCrossV, bitangentF), -dot(NCrossV, tangentF)) / det;
33 |
34 | // find the currect uv position by fix-point iteration
35 | float NDotV = abs(dot(normal, viewDir));
36 | vec2 uv = texCoordF.xy;
37 | float height = 0.0;
38 | for (int i = 0; i < 5; i++)
39 | {
40 | float newHeight = texture2D(thickTex, uv).w * 0.1;
41 | uv = uv + (newHeight - height) / NDotV * viewDir_UV;
42 | height = newHeight;
43 | }
44 |
45 | // compute bumped normal
46 | float offsetHeightU = texture2D(thickTex, uv + vec2(2.0 / 1024.0, 0.0)).w * 0.1;
47 | float offsetHeightV = texture2D(thickTex, uv + vec2(0.0, 2.0 / 1024.0)).w * 0.1;
48 | vec3 deltaNormalU = (height - offsetHeightU) * 1024.0 / length(tangentF) * normalize(tangentF);
49 | vec3 deltaNormalV = (height - offsetHeightV) * 1024.0 / length(bitangentF) * normalize(bitangentF);
50 | vec3 finalNormal = normalize(normal + deltaNormalU + deltaNormalV);
51 |
52 | // compute diffuse and specular color
53 | vec4 color = texture2D(colorTex, uv);
54 | vec4 surf = texture2D(surfTex, uv);
55 |
56 | float NDotL = abs(dot(finalNormal, lightDir));
57 | vec3 R = reflect(lightDir, finalNormal);
58 | float RDotV = abs(dot(R, viewDir));
59 |
60 | // specular color
61 | float roughness = 1 - surf.y;
62 | vec3 F0 = vec3(0.04);
63 | float metalness = surf.w;
64 | F0 = mix(F0, color.rgb, metalness);
65 |
66 | vec3 kS = fresnelSchlickRoughness(NDotV, F0, roughness);
67 | vec3 kD = 1.0 - kS;
68 |
69 | vec3 cubeMapDir = reflect(viewDir, finalNormal);
70 | vec3 cubeMapDirWorld = (viewMatrixTranspose * vec4(cubeMapDir, 0.0)).xyz;
71 | vec4 cubeMapClr = textureCubeLod(envTex, -cubeMapDirWorld, roughness * ENV_MIP_LEVELS);
72 | vec2 envBRDF = textureLod(brdfLUT, vec2(NDotV, roughness), 0).rg;
73 | vec3 specularClr = cubeMapClr.rgb *(F0 * envBRDF.r + envBRDF.g);
74 |
75 | // diffuse color
76 | vec3 cubeMapNormalDirWorld = (viewMatrixTranspose * vec4(finalNormal, 0.0)).xyz;
77 | vec4 irradiance = textureCubeLod(envTex, -cubeMapNormalDirWorld, 5.0);
78 | vec3 diffuseClr = color.rgb * NDotL;
79 | vec3 finalRGB = kD * diffuseClr + specularClr;
80 | gl_FragColor = vec4(finalRGB, finalAlpha);
81 | }
82 |
--------------------------------------------------------------------------------
/vsProject/paint3D/sceneShaderVS.glsl:
--------------------------------------------------------------------------------
1 | attribute vec4 vertexV;
2 | attribute vec3 normalV;
3 | attribute vec3 tangentV;
4 | attribute vec3 bitangentV;
5 | attribute vec4 texCoordV;
6 |
7 | varying vec4 vertexF;
8 | varying vec3 normalF;
9 | varying vec3 tangentF;
10 | varying vec3 bitangentF;
11 | varying vec4 texCoordF;
12 |
13 | void main(void)
14 | {
15 | gl_Position =gl_ModelViewProjectionMatrix * vertexV;
16 | vertexF = gl_ModelViewMatrix * vertexV;
17 | normalF = gl_NormalMatrix * normalV;
18 | tangentF = (gl_ModelViewMatrix * vec4(tangentV,0.0)).xyz;
19 | bitangentF = (gl_ModelViewMatrix * vec4(bitangentV,0.0)).xyz;
20 | texCoordF = texCoordV;
21 | }
--------------------------------------------------------------------------------
/vsProject/paint3D/sliderspinnergroup.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/sliderspinnergroup.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/sliderspinnergroup.h:
--------------------------------------------------------------------------------
1 | #ifndef SLIDERSPINNERGROUP_H
2 | #define SLIDERSPINNERGROUP_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #define SLIDER_MIN_VALUE 0
10 | #define SLIDER_MAX_VALUE 1000
11 |
12 | class SliderSpinnerGroup : public QWidget
13 | {
14 | Q_OBJECT
15 | Q_PROPERTY(double value READ value WRITE setValue)
16 | Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
17 | Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
18 | Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
19 |
20 | public:
21 | SliderSpinnerGroup(QWidget *parent = 0);
22 |
23 |
24 | signals:
25 | void valueChanged(double val);
26 |
27 | private slots:
28 | void setSliderValue(double val);
29 | void setSpinBoxValue(int val);
30 |
31 | public slots:
32 | double value(){return m_spinBox->value();}
33 | double minimum(){return m_spinBox->minimum();}
34 | double maximum(){return m_spinBox->maximum();}
35 | double singleStep(){return m_spinBox->singleStep();}
36 |
37 | void setValue(double val)
38 | {
39 | m_spinBox->setValue(val);
40 | }
41 | void setMinimum(double val)
42 | {
43 | m_spinBox->setMinimum(val);
44 | setSliderValue(m_spinBox->value());
45 | }
46 | void setMaximum(double val)
47 | {
48 | m_spinBox->setMaximum(val);
49 | setSliderValue(m_spinBox->value());
50 | }
51 | void setSingleStep(double val)
52 | {
53 | m_spinBox->setSingleStep(val);
54 | setSliderValue(m_spinBox->value());
55 | }
56 |
57 |
58 | private:
59 | QSlider* m_slider;
60 | QDoubleSpinBox* m_spinBox;
61 | QHBoxLayout* layout;
62 | };
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/vsProject/paint3D/sphere.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 14.05.2012 20:13:02
3 |
4 | newmtl wire_088177027
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.3451 0.6941 0.1059
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/stdafx.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
--------------------------------------------------------------------------------
/vsProject/paint3D/stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/stdafx.h
--------------------------------------------------------------------------------
/vsProject/paint3D/teapot.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 13.05.2012 16:12:01
3 |
4 | newmtl wire_006135113
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.0235 0.5294 0.4431
12 | Ks 0.3500 0.3500 0.3500
13 |
--------------------------------------------------------------------------------
/vsProject/paint3D/teapots.mtl:
--------------------------------------------------------------------------------
1 | # Max2Mtl Version 4.0 Mar 10th, 2001
2 | #
3 | # EOF
4 |
--------------------------------------------------------------------------------
/vsProject/paint3D/test.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/test.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/test2.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/test2.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/toilet.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 03.06.2012 01:51:48
3 |
4 | newmtl wire_153228214
5 | Ns 32
6 | d 1
7 | Tr 1
8 | Tf 1 1 1
9 | illum 2
10 | Ka 0.0000 0.0000 0.0000
11 | Kd 0.6000 0.8941 0.8392
12 | Ks 0.3500 0.3500 0.3500
13 |
14 | newmtl wire_197197131
15 | Ns 32.0000
16 | Ni 1.5000
17 | d 1.0000
18 | Tr 1.0000
19 | Tf 1.0000 1.0000 1.0000
20 | illum 2
21 | Ka 0.0000 0.0000 0.0000
22 | Kd 0.7725 0.7725 0.5137
23 | Ks 0.3500 0.3500 0.3500
24 | Ke 0.0000 0.0000 0.0000
25 |
26 | newmtl wire_177148027
27 | Ns 32
28 | d 1
29 | Tr 1
30 | Tf 1 1 1
31 | illum 2
32 | Ka 0.0000 0.0000 0.0000
33 | Kd 0.6941 0.5804 0.1059
34 | Ks 0.3500 0.3500 0.3500
35 |
--------------------------------------------------------------------------------
/vsProject/paint3D/toilet.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/toilet.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/toiletNew.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/toiletNew.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/triangleMask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/triangleMask.png
--------------------------------------------------------------------------------
/vsProject/paint3D/woodTable.p3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/woodTable.p3d
--------------------------------------------------------------------------------
/vsProject/paint3D/复件 CanvasSeamFiller.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/复件 CanvasSeamFiller.cpp
--------------------------------------------------------------------------------
/vsProject/paint3D/方头画笔.abr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/方头画笔.abr
--------------------------------------------------------------------------------
/vsProject/paint3D/自然画笔 2.abr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/paint3D/自然画笔 2.abr
--------------------------------------------------------------------------------
/vsProject/readme.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/readme.txt
--------------------------------------------------------------------------------
/vsProject/template.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/template.png
--------------------------------------------------------------------------------
/vsProject/详细说明.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/vsProject/详细说明.docx
--------------------------------------------------------------------------------
/双线性插值.gsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/双线性插值.gsp
--------------------------------------------------------------------------------
/四边形插值.gsp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/league1991/Paint3D/52de149f7d9cbc051780c8dde060df1603b1e435/四边形插值.gsp
--------------------------------------------------------------------------------