Macros | Enumerations | Variables
point_cloud_drawable.cpp File Reference
#include <sstream>
#include "point_cloud_drawable.h"
#include "rtabmap/utilite/ULogger.h"
#include "rtabmap/utilite/UTimer.h"
#include "rtabmap/utilite/UConversion.h"
#include <opencv2/imgproc/imgproc.hpp>
#include "util.h"
#include "pcl/common/transforms.h"
#include <GLES2/gl2.h>
Include dependency graph for point_cloud_drawable.cpp:

Go to the source code of this file.

Macros

#define LOW_DEC   2
 
#define LOWLOW_DEC   4
 

Enumerations

enum  PointCloudShaders {
  kPointCloud = 0, kPointCloudBlending = 1, kPointCloudLighting = 2, kPointCloudLightingBlending = 3,
  kTexture = 4, kTextureBlending = 5, kTextureLighting = 6, kTextureLightingBlending = 7,
  kDepthPacking = 8
}
 

Variables

const std::string kPointCloudBlendingFragmentShader
 
const std::string kPointCloudDepthPackingFragmentShader
 
const std::string kPointCloudDepthPackingVertexShader
 
const std::string kPointCloudFragmentShader
 
const std::string kPointCloudLightingVertexShader
 
const std::string kPointCloudVertexShader
 
const std::string kTextureMeshBlendingFragmentShader
 
const std::string kTextureMeshFragmentShader
 
const std::string kTextureMeshLightingVertexShader
 
const std::string kTextureMeshVertexShader
 

Macro Definition Documentation

#define LOW_DEC   2

Definition at line 40 of file point_cloud_drawable.cpp.

#define LOWLOW_DEC   4

Definition at line 41 of file point_cloud_drawable.cpp.

Enumeration Type Documentation

Enumerator
kPointCloud 
kPointCloudBlending 
kPointCloudLighting 
kPointCloudLightingBlending 
kTexture 
kTextureBlending 
kTextureLighting 
kTextureLightingBlending 
kDepthPacking 

Definition at line 43 of file point_cloud_drawable.cpp.

Variable Documentation

const std::string kPointCloudBlendingFragmentShader
Initial value:
=
"precision highp float;\n"
"precision mediump int;\n"
"uniform float uGainR;\n"
"uniform float uGainG;\n"
"uniform float uGainB;\n"
"uniform float uNearZ;\n"
"uniform float uFarZ;\n"
"uniform sampler2D uDepthTexture;\n"
"uniform vec2 uScreenScale;\n"
"varying vec3 vColor;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" vec4 textureColor = vec4(vColor.z, vColor.y, vColor.x, 1.0);\n"
" float alpha = 1.0;\n"
" vec2 coord = uScreenScale * gl_FragCoord.xy;\n;"
" float depth = texture2D(uDepthTexture, coord).r;\n"
" float num = (2.0 * uNearZ * uFarZ);\n"
" float diff = (uFarZ - uNearZ);\n"
" float add = (uFarZ + uNearZ);\n"
" float ndcDepth = depth * 2.0 - 1.0;\n"
" float linearDepth = num / (add - ndcDepth * diff);\n"
" float ndcFragz = gl_FragCoord.z * 2.0 - 1.0;\n"
" float linearFragz = num / (add - ndcFragz * diff);\n"
" if(linearFragz > linearDepth + 0.05)\n"
" alpha=0.0;\n"
" gl_FragColor = vec4(textureColor.r * uGainR * vLightWeighting, textureColor.g * uGainG * vLightWeighting, textureColor.b * uGainB * vLightWeighting, alpha);\n"
"}\n"

Definition at line 114 of file point_cloud_drawable.cpp.

const std::string kPointCloudDepthPackingFragmentShader
Initial value:
=
"precision highp float;\n"
"precision mediump int;\n"
"void main() {\n"
" float toFixed = 255.0/256.0;\n"
" vec4 enc = vec4(1.0, 255.0, 65025.0, 160581375.0) * toFixed * gl_FragCoord.z;\n"
" enc = fract(enc);\n"
" gl_FragColor = enc;\n"
"}\n"

Definition at line 153 of file point_cloud_drawable.cpp.

const std::string kPointCloudDepthPackingVertexShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"attribute vec3 aVertex;\n"
"uniform mat4 uMVP;\n"
"uniform float uPointSize;\n"
"void main() {\n"
" gl_Position = uMVP*vec4(aVertex.x, aVertex.y, aVertex.z, 1.0);\n"
" gl_PointSize = uPointSize;\n"
"}\n"

Definition at line 143 of file point_cloud_drawable.cpp.

const std::string kPointCloudFragmentShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"uniform float uGainR;\n"
"uniform float uGainG;\n"
"uniform float uGainB;\n"
"varying vec3 vColor;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" vec4 textureColor = vec4(vColor.z, vColor.y, vColor.x, 1.0);\n"
" gl_FragColor = vec4(textureColor.r * uGainR * vLightWeighting, textureColor.g * uGainG * vLightWeighting, textureColor.b * uGainB * vLightWeighting, textureColor.a);\n"
"}\n"

Definition at line 102 of file point_cloud_drawable.cpp.

const std::string kPointCloudLightingVertexShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"attribute vec3 aVertex;\n"
"attribute vec3 aNormal;\n"
"attribute vec3 aColor;\n"
"uniform mat4 uMVP;\n"
"uniform mat3 uN;\n"
"uniform vec3 uLightingDirection;\n"
"uniform float uPointSize;\n"
"varying vec3 vColor;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" gl_Position = uMVP*vec4(aVertex.x, aVertex.y, aVertex.z, 1.0);\n"
" gl_PointSize = uPointSize;\n"
" vec3 transformedNormal = uN * aNormal;\n"
" vLightWeighting = max(dot(transformedNormal, uLightingDirection)*0.5+0.5, 0.0);\n"
" if(vLightWeighting<0.5)"
" vLightWeighting=0.5;\n"
" vColor = aColor;\n"
"}\n"

Definition at line 77 of file point_cloud_drawable.cpp.

const std::string kPointCloudVertexShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"attribute vec3 aVertex;\n"
"attribute vec3 aColor;\n"
"uniform mat4 uMVP;\n"
"uniform float uPointSize;\n"
"varying vec3 vColor;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" gl_Position = uMVP*vec4(aVertex.x, aVertex.y, aVertex.z, 1.0);\n"
" gl_PointSize = uPointSize;\n"
" vLightWeighting = 1.0;\n"
" vColor = aColor;\n"
"}\n"

Definition at line 59 of file point_cloud_drawable.cpp.

const std::string kTextureMeshBlendingFragmentShader
Initial value:
=
"precision highp float;\n"
"precision mediump int;\n"
"uniform sampler2D uTexture;\n"
"uniform sampler2D uDepthTexture;\n"
"uniform float uGainR;\n"
"uniform float uGainG;\n"
"uniform float uGainB;\n"
"uniform vec2 uScreenScale;\n"
"uniform float uNearZ;\n"
"uniform float uFarZ;\n"
"varying vec2 vTexCoord;\n"
"varying float vLightWeighting;\n"
""
"void main() {\n"
" vec4 textureColor = texture2D(uTexture, vTexCoord);\n"
" float alpha = 1.0;\n"
" vec2 coord = uScreenScale * gl_FragCoord.xy;\n;"
" float depth = texture2D(uDepthTexture, coord).r;\n"
" float num = (2.0 * uNearZ * uFarZ);\n"
" float diff = (uFarZ - uNearZ);\n"
" float add = (uFarZ + uNearZ);\n"
" float ndcDepth = depth * 2.0 - 1.0;\n"
" float linearDepth = num / (add - ndcDepth * diff);\n"
" float ndcFragz = gl_FragCoord.z * 2.0 - 1.0;\n"
" float linearFragz = num / (add - ndcFragz * diff);\n"
" if(linearFragz > linearDepth + 0.05)\n"
" alpha=0.0;\n"
" gl_FragColor = vec4(textureColor.r * uGainR * vLightWeighting, textureColor.g * uGainG * vLightWeighting, textureColor.b * uGainB * vLightWeighting, alpha);\n"
"}\n"

Definition at line 230 of file point_cloud_drawable.cpp.

const std::string kTextureMeshFragmentShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"uniform sampler2D uTexture;\n"
"uniform float uGainR;\n"
"uniform float uGainG;\n"
"uniform float uGainB;\n"
"varying vec2 vTexCoord;\n"
"varying float vLightWeighting;\n"
""
"void main() {\n"
" vec4 textureColor = texture2D(uTexture, vTexCoord);\n"
" gl_FragColor = vec4(textureColor.r * uGainR * vLightWeighting, textureColor.g * uGainG * vLightWeighting, textureColor.b * uGainB * vLightWeighting, textureColor.a);\n"
"}\n"

Definition at line 216 of file point_cloud_drawable.cpp.

const std::string kTextureMeshLightingVertexShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"attribute vec3 aVertex;\n"
"attribute vec3 aNormal;\n"
"attribute vec2 aTexCoord;\n"
"uniform mat4 uMVP;\n"
"uniform mat3 uN;\n"
"uniform vec3 uLightingDirection;\n"
"varying vec2 vTexCoord;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" gl_Position = uMVP*vec4(aVertex.x, aVertex.y, aVertex.z, 1.0);\n"
" if(aTexCoord.x < 0.0) {\n"
" vTexCoord.x = 1.0;\n"
" vTexCoord.y = 1.0;\n"
" } else {\n"
" vTexCoord = aTexCoord;\n"
" }\n"
" vec3 transformedNormal = uN * aNormal;\n"
" vLightWeighting = max(dot(transformedNormal, uLightingDirection)*0.5+0.5, 0.0);\n"
" if(vLightWeighting<0.5) \n"
" vLightWeighting=0.5;\n"
"}\n"

Definition at line 187 of file point_cloud_drawable.cpp.

const std::string kTextureMeshVertexShader
Initial value:
=
"precision mediump float;\n"
"precision mediump int;\n"
"attribute vec3 aVertex;\n"
"attribute vec2 aTexCoord;\n"
"uniform mat4 uMVP;\n"
"varying vec2 vTexCoord;\n"
"varying float vLightWeighting;\n"
"void main() {\n"
" gl_Position = uMVP*vec4(aVertex.x, aVertex.y, aVertex.z, 1.0);\n"
" if(aTexCoord.x < 0.0) {\n"
" vTexCoord.x = 1.0;\n"
" vTexCoord.y = 1.0;\n"
" } else {\n"
" vTexCoord = aTexCoord;\n"
" }\n"
" vLightWeighting = 1.0;\n"
"}\n"

Definition at line 164 of file point_cloud_drawable.cpp.



rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:37:07