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 <OpenGLES/ES2/gl.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

◆ LOW_DEC

#define LOW_DEC   2

Definition at line 44 of file point_cloud_drawable.cpp.

◆ LOWLOW_DEC

#define LOWLOW_DEC   4

Definition at line 45 of file point_cloud_drawable.cpp.

Enumeration Type Documentation

◆ PointCloudShaders

Enumerator
kPointCloud 
kPointCloudBlending 
kPointCloudLighting 
kPointCloudLightingBlending 
kTexture 
kTextureBlending 
kTextureLighting 
kTextureLightingBlending 
kDepthPacking 

Definition at line 47 of file point_cloud_drawable.cpp.

Variable Documentation

◆ kPointCloudBlendingFragmentShader

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;"
" vec4 depthPacked = texture2D(uDepthTexture, coord);\n"
" float depth = dot(depthPacked, 1./vec4(1.,255.,65025.,16581375.));\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 118 of file point_cloud_drawable.cpp.

◆ kPointCloudDepthPackingFragmentShader

const std::string kPointCloudDepthPackingFragmentShader
Initial value:
=
"precision highp float;\n"
"precision mediump int;\n"
"void main() {\n"
" vec4 enc = vec4(1.,255.,65025.,16581375.) * gl_FragCoord.z;\n"
" enc = fract(enc);\n"
" enc -= enc.yzww * vec2(1./255., 0.).xxxy;\n"
" gl_FragColor = enc;\n"
"}\n"

Definition at line 158 of file point_cloud_drawable.cpp.

◆ kPointCloudDepthPackingVertexShader

const std::string kPointCloudDepthPackingVertexShader
Initial value:
=
"precision highp 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 148 of file point_cloud_drawable.cpp.

◆ kPointCloudFragmentShader

const std::string kPointCloudFragmentShader
Initial value:
=
"precision highp 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 106 of file point_cloud_drawable.cpp.

◆ kPointCloudLightingVertexShader

const std::string kPointCloudLightingVertexShader
Initial value:
=
"precision highp 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 81 of file point_cloud_drawable.cpp.

◆ kPointCloudVertexShader

const std::string kPointCloudVertexShader
Initial value:
=
"precision highp 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 63 of file point_cloud_drawable.cpp.

◆ kTextureMeshBlendingFragmentShader

const std::string kTextureMeshBlendingFragmentShader

Definition at line 235 of file point_cloud_drawable.cpp.

◆ kTextureMeshFragmentShader

const std::string kTextureMeshFragmentShader
Initial value:
=
"precision highp 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 221 of file point_cloud_drawable.cpp.

◆ kTextureMeshLightingVertexShader

const std::string kTextureMeshLightingVertexShader
Initial value:
=
"precision highp 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 192 of file point_cloud_drawable.cpp.

◆ kTextureMeshVertexShader

const std::string kTextureMeshVertexShader
Initial value:
=
"precision highp 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 169 of file point_cloud_drawable.cpp.



rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:25