Changeset 2154


Ignore:
Timestamp:
Dec 19, 2012, 11:16:30 PM (7 years ago)
Author:
sam
Message:

neercs: if shaders don't support integer attributes, pass them as vectors
of ubytes; foreground colour already works.

Location:
trunk/tools/neercs/video
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/text-render.cpp

    r2094 r2154  
    5353    m_datasize = m_shader->GetUniformLocation("u_DataSize");
    5454    m_vdecl
    55       = new VertexDeclaration(VertexStream<uint32_t>(VertexUsage::Color),
    56                               VertexStream<uint32_t>(VertexUsage::Color));
     55      = new VertexDeclaration(VertexStream<u8vec4>(VertexUsage::Color),
     56                              VertexStream<u8vec4>(VertexUsage::Color));
    5757
    5858    CreateBuffers();
     
    6262{
    6363    m_vbo2 = new VertexBuffer(m_cells * sizeof(int32_t));
    64     m_vbo3 = new VertexBuffer(m_cells * sizeof(int32_t));
     64    m_vbo3 = new VertexBuffer(m_cells * sizeof(u8vec4));
    6565
    6666    m_fbo = new FrameBuffer(m_fbo_size);
  • trunk/tools/neercs/video/text.lolfx

    r2138 r2154  
    2424    float v = float((in_Char >> 4u) & 0xfu) / 32.0 + 0.5;
    2525#else
    26     float u = mod(in_Char.x, 16.0) / 32.0 + 0.0;
    27     float v = floor(in_Char.x / 16.0) / 32.0 + 0.5;
     26    vec4 tmp_Char = in_Char * 255.0;
     27
     28    float u = mod(tmp_Char.x, 16.0) / 32.0 + 0.0;
     29    float v = floor(tmp_Char.x / 16.0) / 32.0 + 0.5;
    2830#endif
    2931    pass_UV = vec2(u, v);
     
    4042    float H = float((in_Attr >> 4u) & 0x7u) / 7.0;
    4143#else
     44    vec4 tmp_Attr = in_Attr * 255.0;
     45
    4246    float A = 0.0;
    4347    float B = 0.0;
     
    4650
    4751    float E = 0.0;
    48     float F = mod(floor(in_Attr.y / 8.0), 16.0) / 15.0;
    49     float G = (mod(in_Attr.y, 8.0) * 2.0 + floor(in_Attr.x / 128.0)) / 15.0;
    50     float H = mod(floor(in_Attr.x / 16.0), 8.0) / 7.0;
     52    float F = mod(floor(tmp_Attr.y / 8.0), 16.0) / 15.0;
     53    float G = (mod(tmp_Attr.y, 8.0) * 2.0 + floor(tmp_Attr.x / 128.0)) / 15.0;
     54    float H = mod(floor(tmp_Attr.x / 16.0), 8.0) / 7.0;
    5155#endif
    5256
Note: See TracChangeset for help on using the changeset viewer.