Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
oivAlgebraicShape.h File Reference

Go to the source code of this file.

Classes

struct  OivASRay
 Structure for parameters of the ray. More...
 
struct  OivASPoint
 Structure containing information about the the raycast intersection point. More...
 

Macros

#define OIV_HAS_ASRAY
 

Functions

bool OivASSolveQuadric (in vec3 abc, inout vec2 roots)
 Helper function to solve quadric of type -> a*x*x + b*x + c = 0.
 
bool OivASRayPlaneIntersection (in OivASRay ray, in vec4 plane, inout float t)
 If 'ray' intersects 'plane', returns true and sets location of intersection in 't'.
 
vec4 OivASGetColor ()
 Returns the color (i.e.
 
float OivASGetOpacity ()
 Returns the opacity (i.e.
 
bool OivASIsOpaque ()
 Returns true if the shape is opaque (i.e.
 
void OivASVertexShaderEntry ()
 [Slot] VERTEX_SHADER_ENTRY Defines actions from the vertex shader such as initialize varying parameters from vertex attribute and so on.
 
vec4 OivASComputeColor (in OivASPoint p)
 [Slot] COMPUTE_COLOR Returns the color of the fragment.
 
bool OivASRayIntersection (in OivASRay ray, inout OivASPoint p)
 [Slot] rayIntersection Computes the intersection between ray and shape.
 

Macro Definition Documentation

◆ OIV_HAS_ASRAY

#define OIV_HAS_ASRAY

Definition at line 5 of file oivAlgebraicShape.h.

Function Documentation

◆ OivASComputeColor()

vec4 OivASComputeColor ( in OivASPoint  p)

[Slot] COMPUTE_COLOR Returns the color of the fragment.

Note that for shading facilities, the position, normal and color of the fragment are filled in the input parameter 'p'.

◆ OivASGetColor()

vec4 OivASGetColor ( )

Returns the color (i.e.

from material or vertex color) of the shape.

◆ OivASGetOpacity()

float OivASGetOpacity ( )

Returns the opacity (i.e.

alpha component) of the shape.

◆ OivASIsOpaque()

bool OivASIsOpaque ( )

Returns true if the shape is opaque (i.e.

OivASGetOpacity() == 1.0).

◆ OivASRayIntersection()

bool OivASRayIntersection ( in OivASRay  ray,
inout OivASPoint  p 
)

[Slot] rayIntersection Computes the intersection between ray and shape.

  • ray: ray parameters
  • p: structure containing the intersection point position (if any), normal (if any) and color (if any)
  • return true if there is intersection, false otherwise

Note that all positions and directions are defined in the space specified in the constructor of the SoAlgebraicShape node. The default one is the local frame coordinate centered at (0,0,0) with bounding box coordinates between -1.0 and 1.0.

For example, for a sphere, we consider in this function that the sphere has a radius of 1.0, centered at the origin.

◆ OivASRayPlaneIntersection()

bool OivASRayPlaneIntersection ( in OivASRay  ray,
in vec4  plane,
inout float  t 
)

If 'ray' intersects 'plane', returns true and sets location of intersection in 't'.

Plane is defined by four values 'xyzw', where 'xyz' is the normal vector and 'w' is the distance from the origin (i.e. the point p.w*p.xyz lies on the plane).

◆ OivASSolveQuadric()

bool OivASSolveQuadric ( in vec3  abc,
inout vec2  roots 
)

Helper function to solve quadric of type -> a*x*x + b*x + c = 0.

Returns true if there are roots, stored in 'roots' vector. Note that it can be used in fragment shader only.

◆ OivASVertexShaderEntry()

void OivASVertexShaderEntry ( )

[Slot] VERTEX_SHADER_ENTRY Defines actions from the vertex shader such as initialize varying parameters from vertex attribute and so on.