Home>

The parallel light source illuminates the light as shown in the image below. Since I want to know the direction of the light, I want to visualize the direction of mDirection, so I made two coordinates appropriately from the vector and points A to B? I want to draw a line towards. What should i do?

  struct DirectionLight
    {
        glm :: vec3 mDirection;// direction of light
        glm :: vec3 mDiffuseColor;// Diffuse color
        glm :: vec3 mSpecColor;// Specular color
    };
  • Answer # 1

    Make two coordinates appropriately and point A to B? I want to draw a line toward

    One side (A) is placed at the origin of the coordinate system or at the center of the display.
    B,B = A + suitable value (length) * (representing the direction in which the light source exists) vectorYou can comb it.

    Since it is difficult to distinguish between the two endpoints with a "line",
    Instead, it may be better to show the direction by making a "thin triangle" look like an arrow.
    In that case, another vertex C, for example,
    A vector orthogonal to the "vector (representing the direction in which the light source exists)"VUsing
    C = B + Appropriate value (smaller value) * VYou should prepare it appropriately.