Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
495d53b1
Kaydet (Commit)
495d53b1
authored
Agu 03, 2014
tarafından
weigao
Kaydeden (comit)
Markus Mohrhard
Agu 06, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
make pick shader work when bars scroll
Change-Id: I9a3e0e36b212ff49ad22ac0ff267d04476b4c307
üst
b819026e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
8 deletions
+36
-8
pickingFragmentShader.glsl
chart2/opengl/pickingFragmentShader.glsl
+4
-1
pickingVertexShader.glsl
chart2/opengl/pickingVertexShader.glsl
+6
-1
GL3DRenderer.hxx
chart2/source/view/inc/GL3DRenderer.hxx
+3
-1
GL3DRenderer.cxx
chart2/source/view/main/GL3DRenderer.cxx
+23
-5
No files found.
chart2/opengl/pickingFragmentShader.glsl
Dosyayı görüntüle @
495d53b1
...
@@ -6,11 +6,14 @@
...
@@ -6,11 +6,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
uniform
float
minCoordX
;
varying
vec3
positionWorldspace
;
varying
vec4
fragmentColor
;
varying
vec4
fragmentColor
;
void
main
()
void
main
()
{
{
if
(
positionWorldspace
.
x
<=
minCoordX
)
discard
;
gl_FragColor
=
fragmentColor
;
gl_FragColor
=
fragmentColor
;
}
}
...
...
chart2/opengl/pickingVertexShader.glsl
Dosyayı görüntüle @
495d53b1
...
@@ -9,11 +9,16 @@
...
@@ -9,11 +9,16 @@
attribute
vec3
vPosition
;
attribute
vec3
vPosition
;
uniform
mat4
MVP
;
uniform
mat4
MVP
;
uniform
mat4
M
;
uniform
vec4
vColor
;
uniform
vec4
vColor
;
uniform
float
minCoordX
;
uniform
float
maxCoordX
;
varying
vec4
fragmentColor
;
varying
vec4
fragmentColor
;
varying
vec3
positionWorldspace
;
void
main
()
void
main
()
{
{
positionWorldspace
=
(
M
*
vec4
(
vPosition
,
1
)).
xyz
;
positionWorldspace
.
x
=
clamp
(
positionWorldspace
.
x
,
minCoordX
,
maxCoordX
);
gl_Position
=
MVP
*
vec4
(
vPosition
,
1
);
gl_Position
=
MVP
*
vec4
(
vPosition
,
1
);
fragmentColor
=
vColor
;
fragmentColor
=
vColor
;
}
}
...
...
chart2/source/view/inc/GL3DRenderer.hxx
Dosyayı görüntüle @
495d53b1
...
@@ -356,7 +356,9 @@ private:
...
@@ -356,7 +356,9 @@ private:
GLint
m_2DVertexID
;
GLint
m_2DVertexID
;
GLint
m_2DColorID
;
GLint
m_2DColorID
;
GLint
m_MatrixID
;
GLint
m_MatrixID
;
GLint
m_ModelID
;
GLint
m_MinCoordXID
;
GLint
m_MaxCoordXID
;
PickingShaderResources
();
PickingShaderResources
();
~
PickingShaderResources
();
~
PickingShaderResources
();
...
...
chart2/source/view/main/GL3DRenderer.cxx
Dosyayı görüntüle @
495d53b1
...
@@ -115,6 +115,7 @@ OpenGL3DRenderer::OpenGL3DRenderer():
...
@@ -115,6 +115,7 @@ OpenGL3DRenderer::OpenGL3DRenderer():
,
m_fMaxCoordX
(
0.0
f
)
,
m_fMaxCoordX
(
0.0
f
)
,
m_fCurDistance
(
0.0
f
)
,
m_fCurDistance
(
0.0
f
)
,
m_bUndrawFlag
(
false
)
,
m_bUndrawFlag
(
false
)
,
m_ScrollMoveMatrix
(
glm
::
mat4
(
1.0
))
{
{
m_Polygon3DInfo
.
lineOnly
=
false
;
m_Polygon3DInfo
.
lineOnly
=
false
;
m_Polygon3DInfo
.
twoSidesLighting
=
false
;
m_Polygon3DInfo
.
twoSidesLighting
=
false
;
...
@@ -315,6 +316,9 @@ OpenGL3DRenderer::PickingShaderResources::PickingShaderResources()
...
@@ -315,6 +316,9 @@ OpenGL3DRenderer::PickingShaderResources::PickingShaderResources()
,
m_2DVertexID
(
0
)
,
m_2DVertexID
(
0
)
,
m_2DColorID
(
0
)
,
m_2DColorID
(
0
)
,
m_MatrixID
(
0
)
,
m_MatrixID
(
0
)
,
m_ModelID
(
0
)
,
m_MinCoordXID
(
0
)
,
m_MaxCoordXID
(
0
)
{
{
}
}
...
@@ -329,6 +333,9 @@ void OpenGL3DRenderer::PickingShaderResources::LoadShaders()
...
@@ -329,6 +333,9 @@ void OpenGL3DRenderer::PickingShaderResources::LoadShaders()
m_MatrixID
=
glGetUniformLocation
(
m_CommonProID
,
"MVP"
);
m_MatrixID
=
glGetUniformLocation
(
m_CommonProID
,
"MVP"
);
m_2DVertexID
=
glGetAttribLocation
(
m_CommonProID
,
"vPosition"
);
m_2DVertexID
=
glGetAttribLocation
(
m_CommonProID
,
"vPosition"
);
m_2DColorID
=
glGetUniformLocation
(
m_CommonProID
,
"vColor"
);
m_2DColorID
=
glGetUniformLocation
(
m_CommonProID
,
"vColor"
);
m_ModelID
=
glGetUniformLocation
(
m_CommonProID
,
"M"
);
m_MinCoordXID
=
glGetUniformLocation
(
m_CommonProID
,
"minCoordX"
);
m_MaxCoordXID
=
glGetUniformLocation
(
m_CommonProID
,
"maxCoordX"
);
}
}
void
OpenGL3DRenderer
::
SetCameraInfo
(
const
glm
::
vec3
&
pos
,
const
glm
::
vec3
&
direction
,
const
glm
::
vec3
&
up
)
void
OpenGL3DRenderer
::
SetCameraInfo
(
const
glm
::
vec3
&
pos
,
const
glm
::
vec3
&
direction
,
const
glm
::
vec3
&
up
)
...
@@ -884,6 +891,10 @@ void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
...
@@ -884,6 +891,10 @@ void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
if
(
mbPickingMode
)
if
(
mbPickingMode
)
{
{
glUseProgram
(
maPickingResources
.
m_CommonProID
);
glUseProgram
(
maPickingResources
.
m_CommonProID
);
float
minCoordX
=
0.0
f
;
float
maxCoordX
=
m_fMinCoordX
+
m_fMaxCoordX
;
glUniform1fv
(
maPickingResources
.
m_MinCoordXID
,
1
,
&
minCoordX
);
glUniform1fv
(
maPickingResources
.
m_MaxCoordXID
,
1
,
&
maxCoordX
);
}
}
else
else
{
{
...
@@ -1327,7 +1338,7 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
...
@@ -1327,7 +1338,7 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
extrude3D
.
zTransform
};
extrude3D
.
zTransform
};
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
glm
::
mat4
flatScale
=
glm
::
scale
(
glm
::
vec3
(
xyScale
,
xyScale
,
xyScale
));
glm
::
mat4
flatScale
=
glm
::
scale
(
glm
::
vec3
(
xyScale
,
xyScale
,
xyScale
));
m_Model
=
m_GlobalScaleMatrix
*
aTranslationMatrix
*
extrude3D
.
rotation
*
flatScale
;
m_Model
=
m_
ScrollMoveMatrix
*
m_
GlobalScaleMatrix
*
aTranslationMatrix
*
extrude3D
.
rotation
*
flatScale
;
if
(
!
mbPickingMode
)
if
(
!
mbPickingMode
)
{
{
glm
::
mat3
normalMatrix
(
m_Model
);
glm
::
mat3
normalMatrix
(
m_Model
);
...
@@ -1338,6 +1349,7 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
...
@@ -1338,6 +1349,7 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
else
else
{
{
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glUniformMatrix4fv
(
maPickingResources
.
m_ModelID
,
1
,
GL_FALSE
,
&
m_Model
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
}
}
...
@@ -1371,7 +1383,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
...
@@ -1371,7 +1383,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
m_Model
=
aTranslationMatrix
*
extrude3D
.
rotation
*
topTrans
*
topScale
;
m_Model
=
aTranslationMatrix
*
extrude3D
.
rotation
*
topTrans
*
topScale
;
}
}
m_Model
=
m_GlobalScaleMatrix
*
m_Model
;
m_Model
=
m_
ScrollMoveMatrix
*
m_
GlobalScaleMatrix
*
m_Model
;
if
(
!
mbPickingMode
)
if
(
!
mbPickingMode
)
{
{
glm
::
mat3
normalMatrix
(
m_Model
);
glm
::
mat3
normalMatrix
(
m_Model
);
...
@@ -1382,6 +1394,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
...
@@ -1382,6 +1394,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
else
else
{
{
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glUniformMatrix4fv
(
maPickingResources
.
m_ModelID
,
1
,
GL_FALSE
,
&
m_Model
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
}
}
...
@@ -1416,7 +1429,7 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
...
@@ -1416,7 +1429,7 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
glm
::
mat4
reverseMatrix
=
glm
::
translate
(
glm
::
vec3
(
0.0
,
0.0
,
-
1.0
));
glm
::
mat4
reverseMatrix
=
glm
::
translate
(
glm
::
vec3
(
0.0
,
0.0
,
-
1.0
));
m_Model
=
m_Model
*
reverseMatrix
;
m_Model
=
m_Model
*
reverseMatrix
;
}
}
m_Model
=
m_GlobalScaleMatrix
*
m_Model
;
m_Model
=
m_
ScrollMoveMatrix
*
m_
GlobalScaleMatrix
*
m_Model
;
if
(
!
mbPickingMode
)
if
(
!
mbPickingMode
)
{
{
glm
::
mat3
normalMatrix
(
m_Model
);
glm
::
mat3
normalMatrix
(
m_Model
);
...
@@ -1427,6 +1440,7 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
...
@@ -1427,6 +1440,7 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
else
else
{
{
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glUniformMatrix4fv
(
maPickingResources
.
m_ModelID
,
1
,
GL_FALSE
,
&
m_Model
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
}
}
...
@@ -1461,7 +1475,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
...
@@ -1461,7 +1475,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
glm
::
mat4
aTranslationMatrix
=
glm
::
translate
(
glm
::
vec3
(
trans
.
x
,
trans
.
y
,
trans
.
z
));
m_Model
=
aTranslationMatrix
*
extrude3D
.
rotation
*
topTrans
*
topScale
*
orgTrans
;
m_Model
=
aTranslationMatrix
*
extrude3D
.
rotation
*
topTrans
*
topScale
*
orgTrans
;
}
}
m_Model
=
m_GlobalScaleMatrix
*
m_Model
;
m_Model
=
m_
ScrollMoveMatrix
*
m_
GlobalScaleMatrix
*
m_Model
;
if
(
!
mbPickingMode
)
if
(
!
mbPickingMode
)
{
{
glm
::
mat3
normalMatrix
(
m_Model
);
glm
::
mat3
normalMatrix
(
m_Model
);
...
@@ -1472,6 +1486,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
...
@@ -1472,6 +1486,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
else
else
{
{
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glUniformMatrix4fv
(
maPickingResources
.
m_ModelID
,
1
,
GL_FALSE
,
&
m_Model
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
}
}
...
@@ -1491,7 +1506,7 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
...
@@ -1491,7 +1506,7 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
glm
::
mat4
reverseMatrix
=
glm
::
translate
(
glm
::
vec3
(
0.0
,
0.0
,
-
1.0
));
glm
::
mat4
reverseMatrix
=
glm
::
translate
(
glm
::
vec3
(
0.0
,
0.0
,
-
1.0
));
m_Model
=
m_Model
*
reverseMatrix
;
m_Model
=
m_Model
*
reverseMatrix
;
}
}
m_Model
=
m_GlobalScaleMatrix
*
m_Model
;
m_Model
=
m_
ScrollMoveMatrix
*
m_
GlobalScaleMatrix
*
m_Model
;
if
(
!
mbPickingMode
)
if
(
!
mbPickingMode
)
{
{
glm
::
mat3
normalMatrix
(
m_Model
);
glm
::
mat3
normalMatrix
(
m_Model
);
...
@@ -1502,6 +1517,7 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
...
@@ -1502,6 +1517,7 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
else
else
{
{
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glm
::
mat4
aMVP
=
m_3DProjection
*
m_3DView
*
m_Model
;
glUniformMatrix4fv
(
maPickingResources
.
m_ModelID
,
1
,
GL_FALSE
,
&
m_Model
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniformMatrix4fv
(
maPickingResources
.
m_MatrixID
,
1
,
GL_FALSE
,
&
aMVP
[
0
][
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
glUniform4fv
(
maPickingResources
.
m_2DColorID
,
1
,
&
extrude3D
.
id
[
0
]);
}
}
...
@@ -1536,6 +1552,8 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
...
@@ -1536,6 +1552,8 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
if
(
mbPickingMode
)
if
(
mbPickingMode
)
{
{
glUseProgram
(
maPickingResources
.
m_CommonProID
);
glUseProgram
(
maPickingResources
.
m_CommonProID
);
glUniform1fv
(
maPickingResources
.
m_MinCoordXID
,
1
,
&
m_fMinCoordX
);
glUniform1fv
(
maPickingResources
.
m_MaxCoordXID
,
1
,
&
m_fMaxCoordX
);
}
}
else
else
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment