This commit is contained in:
ericrius1 2015-07-28 11:42:23 -07:00
parent b44193c2ad
commit b4a9469dff
2 changed files with 7 additions and 7 deletions

View file

@ -42,8 +42,8 @@ GLint RenderablePolyLineEntityItem::PAINTSTROKE_GPU_SLOT;
void RenderablePolyLineEntityItem::createPipeline() {
static const int NORMAL_OFFSET = 12;
// static const int COLOR_OFFSET = 24;
static const int TEXTURE_OFFSET = 24;
static const int COLOR_OFFSET = 24;
static const int TEXTURE_OFFSET = 28;
auto textureCache = DependencyManager::get<TextureCache>();
QString path = PathUtils::resourcesPath() + "images/paintStroke.png";
@ -54,7 +54,7 @@ void RenderablePolyLineEntityItem::createPipeline() {
_format.reset(new gpu::Stream::Format());
_format->setAttribute(gpu::Stream::POSITION, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
_format->setAttribute(gpu::Stream::NORMAL, 0, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), NORMAL_OFFSET);
// _format->setAttribute(gpu::Stream::COLOR, 0, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), COLOR_OFFSET);
_format->setAttribute(gpu::Stream::COLOR, 0, gpu::Element(gpu::VEC4, gpu::UINT8, gpu::RGBA), COLOR_OFFSET);
_format->setAttribute(gpu::Stream::TEXCOORD, 0, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV), TEXTURE_OFFSET);
auto VS = gpu::ShaderPointer(gpu::Shader::createVertex(std::string(paintStroke_vert)));
@ -112,7 +112,7 @@ void RenderablePolyLineEntityItem::updateGeometry() {
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_vertices.at(vertexIndex));
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_normals.at(i));
// _verticesBuffer->append(sizeof(int), (gpu::Byte*)&_color);
_verticesBuffer->append(sizeof(int), (gpu::Byte*)&_color);
_verticesBuffer->append(sizeof(glm::vec2), (gpu::Byte*)&uv);
vertexIndex++;
@ -120,7 +120,7 @@ void RenderablePolyLineEntityItem::updateGeometry() {
uv.y = 1.0;
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_vertices.at(vertexIndex));
_verticesBuffer->append(sizeof(glm::vec3), (const gpu::Byte*)&_normals.at(i));
// _verticesBuffer->append(sizeof(int), (gpu::Byte*)_color);
_verticesBuffer->append(sizeof(int), (gpu::Byte*)_color);
_verticesBuffer->append(sizeof(glm::vec2), (const gpu::Byte*)&uv);
vertexIndex++;

View file

@ -35,12 +35,12 @@ void main(void) {
vec4 texel = texture2D(originalTexture, varTexcoord);
int frontCondition = 1 -int(gl_FrontFacing) * 2;
// vec3 color = gl_Color.rgb;
vec3 color = gl_Color.rgb;
//vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess
packDeferredFragmentTranslucent(
newNormal * frontCondition,
texel.a,
texel.rgb,
color *texel.rgb,
vec3(0.01, 0.01, 0.01),
10.0);
}