| http://www.sim.no/ http://www.coin3d.org/

Public Member Functions | List of all members
SoNormalCache Class Reference
Cache Classes

The SoNormalCache class is used to hold cached normals.As an extension to the original SGI Open Inventor v2.1 API, it is also possible to generate normals using this class. More...

`#include <Inventor/caches/SoNormalCache.h>`

Inheritance diagram for SoNormalCache:

## Public Member Functions

| SoNormalCache (SoState *const state)
virtual | ~SoNormalCache ()
void | set (const int num, const SbVec3f *const normals)
void | set (SoNormalGenerator *generator)
int | getNum (void) const
const SbVec3f * | getNormals (void) const
int | getNumIndices (void) const
const int32_t * | getIndices (void) const
void | generatePerVertex (const SbVec3f *const coords, const unsigned int numcoords, const int32_t *coordindices, const int numcoordindices, const float crease_angle, const SbVec3f *facenormals=NULL, const int numfacenormals=-1, const SbBool ccw=TRUE, const SbBool tristrip=FALSE)
void | generatePerFace (const SbVec3f *const coords, const unsigned int numcoords, const int32_t *coordindices, const int numcoorindices, const SbBool ccw)
void | generatePerFaceStrip (const SbVec3f *const coords, const unsigned int numcoords, const int32_t *coordindices, const int numcoorindices, const SbBool ccw)
void | generatePerStrip (const SbVec3f *const coords, const unsigned int numcoords, const int32_t *coordindices, const int numcoorindices, const SbBool ccw)
void | generatePerVertexQuad (const SbVec3f *const coords, const unsigned int numcoords, const int vPerRow, const int vPerColumn, const SbBool ccw)
void | generatePerFaceQuad (const SbVec3f *const coords, const unsigned int numcoords, const int vPerRow, const int vPerColumn, const SbBool ccw)
void | generatePerRowQuad (const SbVec3f *const coords, const unsigned int numcoords, const int vPerRow, const int vPerColumn, const SbBool ccw)
Public Member Functions inherited from SoCache
| SoCache (SoState *const state)
void | ref (void)
void | unref (SoState *state=NULL)
void | addElement (const SoElement *const elem)
virtual void | addCacheDependency (const SoState *state, SoCache *cache)
virtual SbBool | isValid (const SoState *state) const
const SoElement * | getInvalidElement (const SoState *const state) const
void | invalidate (void)

## Additional Inherited Members

Protected Member Functions inherited from SoCache
virtual void | destroy (SoState *state)
virtual | ~SoCache ()

## Detailed Description

The SoNormalCache class is used to hold cached normals.

As an extension to the original SGI Open Inventor v2.1 API, it is also possible to generate normals using this class.

It is more powerful and easier to use than the SoNormalGenerator class. It is possible to generate normals per vertex with indices (using much less memory than plain per vertex normals), and it contains special methods to generate normals for triangle strips and quads.

## Constructor & Destructor Documentation

## ◆ SoNormalCache()

SoNormalCache::SoNormalCache | ( | SoState *const | state | ) |

Contructor with state being the current state.

## ◆ ~SoNormalCache()

SoNormalCache::~SoNormalCache | ( |  | ) |

virtual

Destructor

## Member Function Documentation

## ◆ set() [1/2]

void SoNormalCache::set | ( | const int | num,
|  | const SbVec3f *const | normals
| ) |  |

Sets an array of normals for this cache. The normals will not be deleted when the instance is deleted.

## ◆ set() [2/2]

void SoNormalCache::set | ( | SoNormalGenerator * | generator | ) |

Uses a normal generator in this cache. The normal generator will be deleted when the cache is deleted or reset.

## ◆ getNum()

int SoNormalCache::getNum | ( | void |  | ) | const

Returns the number of normals in the cache.

## ◆ getNormals()

const SbVec3f * SoNormalCache::getNormals | ( | void |  | ) | const

Return a pointer to the normals in this cache.

## ◆ getNumIndices()

int SoNormalCache::getNumIndices | ( | void |  | ) | const

Returns the number of indices in this cache. Normals are generated with PER_VERTEX_INDEXED binding.

## ◆ getIndices()

const int32_t * SoNormalCache::getIndices | ( | void |  | ) | const

Returns the normal indices.

## ◆ generatePerVertex()

void SoNormalCache::generatePerVertex | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int32_t * | vindex,
|  | const int | numvi,
|  | const float | crease_angle,
|  | const SbVec3f * | facenormals = `NULL`,
|  | const int | numfacenormals = `-1`,
|  | const SbBool | ccw = `TRUE`,
|  | const SbBool | tristrip = `FALSE`
| ) |  |

Generates normals for each vertex for each face. It is possible to specify face normals if these have been calculated somewhere else, otherwise the face normals will be calculated before the vertex normals are calculated. tristrip should be `TRUE` if the geometry consists of triangle strips.

## ◆ generatePerFace()

void SoNormalCache::generatePerFace | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int32_t * | cind,
|  | const int | nv,
|  | const SbBool | ccw
| ) |  |

Generates face normals for the faceset defined by coords and cind.

## ◆ generatePerFaceStrip()

void SoNormalCache::generatePerFaceStrip | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int32_t * | cind,
|  | const int | nv,
|  | const SbBool | ccw
| ) |  |

Generates face normals for triangle strips.

## ◆ generatePerStrip()

void SoNormalCache::generatePerStrip | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int32_t * | cind,
|  | const int | nv,
|  | const SbBool | ccw
| ) |  |

Generates one normal per triangle strips (avarages all triangle normals).

## ◆ generatePerVertexQuad()

void SoNormalCache::generatePerVertexQuad | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int | vPerRow,
|  | const int | vPerColumn,
|  | const SbBool | ccw
| ) |  |

Generates PER_VERTEX normals for quad data.

## ◆ generatePerFaceQuad()

void SoNormalCache::generatePerFaceQuad | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int | vPerRow,
|  | const int | vPerColumn,
|  | const SbBool | ccw
| ) |  |

Generates per face normals for quad data.

## ◆ generatePerRowQuad()

void SoNormalCache::generatePerRowQuad | ( | const SbVec3f *const | coords,
|  | const unsigned int | numcoords,
|  | const int | vPerRow,
|  | const int | vPerColumn,
|  | const SbBool | ccw
| ) |  |

Generates per row normals for quad data.

The documentation for this class was generated from the following files:

- SoNormalCache.h
- SoNormalCache.cpp

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.