Exemplo n.º 1
0
    vector<glsl::vec2> const & GenerateCap(LineSegment const & segment, EPointType type,
                                           float sign, bool isStart)
    {
        m_normalBuffer.clear();
        m_normalBuffer.reserve(24);

        GenerateCapNormals(m_params.m_cap,
                           segment.m_leftNormals[type],
                           segment.m_rightNormals[type],
                           sign * segment.m_tangent,
                           GetHalfWidth(), isStart, m_normalBuffer);

        return m_normalBuffer;
    }
Exemplo n.º 2
0
    void CreateRoundCap(glsl::vec2 const & pos)
    {
        m_capGeometry.reserve(8);

        float const radius = GetHalfWidth();

        m_capGeometry.push_back(CapVertex(CapVertex::TPosition(pos, m_params.m_depth),
                                          CapVertex::TNormal(-radius, radius, radius),
                                          CapVertex::TTexCoord(m_colorCoord)));
        m_capGeometry.push_back(CapVertex(CapVertex::TPosition(pos, m_params.m_depth),
                                          CapVertex::TNormal(-radius, -radius, radius),
                                          CapVertex::TTexCoord(m_colorCoord)));
        m_capGeometry.push_back(CapVertex(CapVertex::TPosition(pos, m_params.m_depth),
                                          CapVertex::TNormal(radius, radius, radius),
                                          CapVertex::TTexCoord(m_colorCoord)));
        m_capGeometry.push_back(CapVertex(CapVertex::TPosition(pos, m_params.m_depth),
                                          CapVertex::TNormal(radius, -radius, radius),
                                          CapVertex::TTexCoord(m_colorCoord)));
    }
Exemplo n.º 3
0
    vector<glsl::vec2> const & GenerateJoin(LineSegment const & seg1, LineSegment const & seg2)
    {
        m_normalBuffer.clear();
        m_normalBuffer.reserve(24);

        glsl::vec2 n1 = seg1.m_hasLeftJoin[EndPoint] ? seg1.m_leftNormals[EndPoint] :
                        seg1.m_rightNormals[EndPoint];

        glsl::vec2 n2 = seg2.m_hasLeftJoin[StartPoint] ? seg2.m_leftNormals[StartPoint] :
                        seg2.m_rightNormals[StartPoint];

        float widthScalar = seg1.m_hasLeftJoin[EndPoint] ? seg1.m_rightWidthScalar[EndPoint].x :
                            seg1.m_leftWidthScalar[EndPoint].x;

        GenerateJoinNormals(m_params.m_join, n1, n2, GetHalfWidth(),
                            seg1.m_hasLeftJoin[EndPoint], widthScalar, m_normalBuffer);

        return m_normalBuffer;
    }
Exemplo n.º 4
0
void Sector::SetHalfHeight(double height) {
    SetHalfExtents(GetHalfWidth(), height);
}
Exemplo n.º 5
0
 void SubmitVertex(glsl::vec3 const & pivot, glsl::vec2 const & normal, bool isLeft, float offsetFromStart)
 {
     float const halfWidth = GetHalfWidth();
     m_geometry.emplace_back(V(pivot, TNormal(halfWidth * normal, halfWidth * GetSide(isLeft)),
                               m_colorCoord, m_texCoordGen.GetTexCoordsByDistance(offsetFromStart)));
 }
Exemplo n.º 6
0
 void SubmitVertex(glsl::vec3 const & pivot, glsl::vec2 const & normal, bool isLeft)
 {
     float const halfWidth = GetHalfWidth();
     m_geometry.emplace_back(V(pivot, TNormal(halfWidth * normal, halfWidth * GetSide(isLeft)), m_colorCoord));
 }