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
4cde86a6
Kaydet (Commit)
4cde86a6
authored
May 28, 2014
tarafından
weigao
Kaydeden (comit)
Markus Mohrhard
May 28, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add batch render function
üst
3b3f92be
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
4 deletions
+137
-4
GL3DRenderer.hxx
chart2/source/view/inc/GL3DRenderer.hxx
+1
-0
StaticGeometry.h
chart2/source/view/inc/StaticGeometry.h
+3
-3
GL3DRenderer.cxx
chart2/source/view/main/GL3DRenderer.cxx
+133
-1
No files found.
chart2/source/view/inc/GL3DRenderer.hxx
Dosyayı görüntüle @
4cde86a6
...
...
@@ -230,6 +230,7 @@ private:
void
GetBatchMiddleInfo
(
Extrude3DInfo
&
extrude3D
);
void
InitBatch3DUniformBlock
();
void
UpdateBatch3DUniformBlock
();
void
RenderBatchBars
();
private
:
struct
ShaderResources
...
...
chart2/source/view/inc/StaticGeometry.h
Dosyayı görüntüle @
4cde86a6
...
...
@@ -12,9 +12,9 @@
#define TOP_SURFACE 0
#define MIDDLE_SURFACE 1
#define BOTTOM_SURFACE 2
#define
FLAT_TOP
_SURFACE 3
#define FLAT_
BOTTOM
_SURFACE 4
#define
FLAT_
BOTTOM_SURFACE 2
#define
BOTTOM
_SURFACE 3
#define FLAT_
TOP
_SURFACE 4
static
GLfloat
boundBox
[]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
...
...
chart2/source/view/main/GL3DRenderer.cxx
Dosyayı görüntüle @
4cde86a6
...
...
@@ -119,6 +119,9 @@ OpenGL3DRenderer::~OpenGL3DRenderer()
glDeleteBuffers
(
1
,
&
m_3DUBOBuffer
);
glDeleteBuffers
(
1
,
&
m_VertexBuffer
);
glDeleteBuffers
(
1
,
&
m_NormalBuffer
);
glDeleteBuffers
(
1
,
&
m_Batch3DUBOBuffer
);
glDeleteBuffers
(
1
,
&
m_3DUBOBuffer
);
glDeleteBuffers
(
1
,
&
m_3DUBOBuffer
);
glDeleteFramebuffers
(
1
,
&
mnPickingFbo
);
glDeleteRenderbuffers
(
1
,
&
mnPickingRboDepth
);
...
...
@@ -146,6 +149,14 @@ OpenGL3DRenderer::ShaderResources::ShaderResources()
,
m_2DVertexID
(
0
)
,
m_2DColorID
(
0
)
,
m_MatrixID
(
0
)
,
m_3DBatchProID
(
0
)
,
m_3DBatchProjectionID
(
0
)
,
m_3DBatchViewID
(
0
)
,
m_3DBatchModelID
(
0
)
,
m_3DBatchNormalMatrixID
(
0
)
,
m_3DBatchVertexID
(
0
)
,
m_3DBatchNormalID
(
0
)
,
m_3DBatchColorID
(
0
)
{
}
...
...
@@ -155,6 +166,7 @@ OpenGL3DRenderer::ShaderResources::~ShaderResources()
glDeleteProgram
(
m_TextProID
);
glDeleteProgram
(
m_ScreenTextProID
);
glDeleteProgram
(
m_3DProID
);
glDeleteProgram
(
m_3DBatchProID
);
}
void
OpenGL3DRenderer
::
ShaderResources
::
LoadShaders
()
...
...
@@ -183,6 +195,14 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
m_2DVertexID
=
glGetAttribLocation
(
m_CommonProID
,
"vPosition"
);
m_2DColorID
=
glGetUniformLocation
(
m_CommonProID
,
"vColor"
);
m_3DBatchProID
=
OpenGLHelper
::
LoadShaders
(
"shape3DVertexShaderBatch"
,
"shape3DFragmentShaderBatch"
);
m_3DBatchProjectionID
=
glGetUniformLocation
(
m_3DBatchProID
,
"P"
);
m_3DBatchViewID
=
glGetUniformLocation
(
m_3DBatchProID
,
"V"
);
m_3DBatchModelID
=
glGetAttribLocation
(
m_3DBatchProID
,
"M"
);
m_3DBatchNormalMatrixID
=
glGetAttribLocation
(
m_3DBatchProID
,
"normalMatrix"
);
m_3DBatchVertexID
=
glGetAttribLocation
(
m_3DBatchProID
,
"vertexPositionModelspace"
);
m_3DBatchNormalID
=
glGetAttribLocation
(
m_3DBatchProID
,
"vertexNormalModelspace"
);
m_3DBatchColorID
=
glGetAttribLocation
(
m_3DBatchProID
,
"barColor"
);
CHECK_GL_ERROR
();
}
...
...
@@ -243,6 +263,9 @@ void OpenGL3DRenderer::init()
glGenBuffers
(
1
,
&
m_CubeElementBuf
);
glGenBuffers
(
1
,
&
m_VertexBuffer
);
glGenBuffers
(
1
,
&
m_NormalBuffer
);
glGenBuffers
(
1
,
&
m_BatchModelMatrixBuf
);
glGenBuffers
(
1
,
&
m_BatchNormalMatrixBuf
);
glGenBuffers
(
1
,
&
m_BatchColorBuf
);
glGenBuffers
(
1
,
&
m_BoundBox
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BoundBox
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
boundBox
),
boundBox
,
GL_STATIC_DRAW
);
...
...
@@ -1028,6 +1051,7 @@ void OpenGL3DRenderer::AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 nC
m_Normals
.
clear
();
m_Indices
.
clear
();
}
m_Batchmaterial
=
m_Extrude3DInfo
.
material
;
}
void
OpenGL3DRenderer
::
EndAddShape3DExtrudeObject
()
...
...
@@ -1679,7 +1703,8 @@ void OpenGL3DRenderer::ProcessUnrenderedShape()
//Polygon
RenderPolygon3DObject
();
//Shape3DExtrudeObject
RenderExtrude3DObject
();
RenderBatchBars
();
// RenderExtrude3DObject();
//render text
RenderTextShape
();
// render screen text
...
...
@@ -1839,6 +1864,113 @@ void OpenGL3DRenderer::GetBatchBarsInfo()
}
}
}
void
OpenGL3DRenderer
::
RenderBatchBars
()
{
GetBatchBarsInfo
();
glEnable
(
GL_DEPTH_TEST
);
glEnable
(
GL_CULL_FACE
);
glCullFace
(
GL_BACK
);
glUseProgram
(
maResources
.
m_3DBatchProID
);
UpdateBatch3DUniformBlock
();
glBindBuffer
(
GL_UNIFORM_BUFFER
,
m_Batch3DUBOBuffer
);
glBufferSubData
(
GL_UNIFORM_BUFFER
,
m_Batch3DActualSizeLight
,
sizeof
(
MaterialParameters
),
&
m_Batchmaterial
);
CHECK_GL_ERROR
();
glBindBuffer
(
GL_UNIFORM_BUFFER
,
0
);
glUniformMatrix4fv
(
maResources
.
m_3DBatchViewID
,
1
,
GL_FALSE
,
&
m_3DView
[
0
][
0
]);
glUniformMatrix4fv
(
maResources
.
m_3DBatchProjectionID
,
1
,
GL_FALSE
,
&
m_3DProjection
[
0
][
0
]);
CHECK_GL_ERROR
();
GLuint
vertexBuf
=
m_Extrude3DInfo
.
rounded
?
m_CubeVertexBuf
:
m_BoundBox
;
GLuint
normalBuf
=
m_Extrude3DInfo
.
rounded
?
m_CubeNormalBuf
:
m_BoundBoxNormal
;
//vertex
glEnableVertexAttribArray
(
maResources
.
m_3DBatchVertexID
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
vertexBuf
);
glVertexAttribPointer
(
maResources
.
m_3DBatchVertexID
,
// attribute
3
,
// size
GL_FLOAT
,
// type
GL_FALSE
,
// normalized?
0
,
// stride
(
void
*
)
0
// array buffer offset
);
//normal
glEnableVertexAttribArray
(
maResources
.
m_3DBatchNormalID
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
normalBuf
);
glVertexAttribPointer
(
maResources
.
m_3DBatchNormalID
,
// attribute
3
,
// size
GL_FLOAT
,
// type
GL_FALSE
,
// normalized?
0
,
// stride
(
void
*
)
0
// array buffer offset
);
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
glEnableVertexAttribArray
(
maResources
.
m_3DBatchModelID
+
i
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchModelMatrixBuf
);
glVertexAttribPointer
(
maResources
.
m_3DBatchModelID
+
i
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat4
),
reinterpret_cast
<
GLvoid
*>
(
sizeof
(
GLfloat
)
*
i
*
4
));
glVertexAttribDivisor
(
maResources
.
m_3DBatchModelID
+
i
,
1
);
}
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
glEnableVertexAttribArray
(
maResources
.
m_3DBatchNormalMatrixID
+
i
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchNormalMatrixBuf
);
glVertexAttribPointer
(
maResources
.
m_3DBatchNormalMatrixID
+
i
,
3
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
mat3
),
reinterpret_cast
<
GLvoid
*>
(
sizeof
(
GLfloat
)
*
i
*
3
));
glVertexAttribDivisor
(
maResources
.
m_3DBatchNormalMatrixID
+
i
,
1
);
}
glEnableVertexAttribArray
(
maResources
.
m_3DBatchColorID
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchColorBuf
);
glVertexAttribPointer
(
maResources
.
m_3DBatchColorID
,
4
,
GL_FLOAT
,
GL_FALSE
,
sizeof
(
glm
::
vec4
),
0
);
glVertexAttribDivisor
(
maResources
.
m_3DBatchColorID
,
1
);
if
(
m_Extrude3DInfo
.
rounded
)
{
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
m_CubeElementBuf
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchModelMatrixBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
mat4
)
*
m_BarSurface
[
i
].
modelMatrixList
.
size
(),
&
m_BarSurface
[
i
].
modelMatrixList
[
0
][
0
],
GL_DYNAMIC_DRAW
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchNormalMatrixBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
mat3
)
*
m_BarSurface
[
i
].
normalMatrixList
.
size
(),
&
m_BarSurface
[
i
].
normalMatrixList
[
0
][
0
],
GL_DYNAMIC_DRAW
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchColorBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
vec4
)
*
m_BarSurface
[
i
].
colorList
.
size
(),
&
m_BarSurface
[
i
].
colorList
[
0
],
GL_DYNAMIC_DRAW
);
glDrawElementsInstancedBaseVertex
(
GL_TRIANGLES
,
m_Extrude3DInfo
.
size
[
i
],
GL_UNSIGNED_SHORT
,
reinterpret_cast
<
GLvoid
*>
(
m_Extrude3DInfo
.
startIndex
[
i
]),
m_BarSurface
[
i
].
modelMatrixList
.
size
(),
0
);
}
}
else
{
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchModelMatrixBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
mat4
)
*
m_BarSurface
[
0
].
modelMatrixList
.
size
(),
&
m_BarSurface
[
0
].
modelMatrixList
[
0
][
0
],
GL_DYNAMIC_DRAW
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchNormalMatrixBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
mat3
)
*
m_BarSurface
[
0
].
normalMatrixList
.
size
(),
&
m_BarSurface
[
0
].
normalMatrixList
[
0
][
0
],
GL_DYNAMIC_DRAW
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
m_BatchColorBuf
);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
glm
::
vec4
)
*
m_BarSurface
[
0
].
colorList
.
size
(),
&
m_BarSurface
[
0
].
colorList
[
0
],
GL_DYNAMIC_DRAW
);
glDrawArraysInstanced
(
GL_TRIANGLES
,
0
,
36
,
m_BarSurface
[
0
].
modelMatrixList
.
size
());
}
glDisableVertexAttribArray
(
maResources
.
m_3DBatchVertexID
);
glDisableVertexAttribArray
(
maResources
.
m_3DBatchNormalID
);
glDisableVertexAttribArray
(
maResources
.
m_3DBatchColorID
);
glVertexAttribDivisor
(
maResources
.
m_3DBatchColorID
,
0
);
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
glDisableVertexAttribArray
(
maResources
.
m_3DBatchModelID
+
i
);
glVertexAttribDivisor
(
maResources
.
m_3DBatchModelID
+
i
,
0
);
}
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
glDisableVertexAttribArray
(
maResources
.
m_3DBatchNormalMatrixID
+
i
);
glVertexAttribDivisor
(
maResources
.
m_3DBatchNormalMatrixID
+
i
,
0
);
}
glFinish
();
glUseProgram
(
0
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
0
);
glDisable
(
GL_CULL_FACE
);
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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