Definitions


A definition is the name for any of the resources that are stored in a portfolio. There are eight types of definitions:

DefinitionDescription
HPS::NamedStyleDefinition A named group of attributes applied to a segment as opposed to setting attributes individually. See this section for details.
HPS::GlyphDefinition A simple geometric symbol used for styling markers, vertices and lines. For an in-depth discussion on glyphs, see this section.
HPS::ImageDefinition A two dimensional array of pixel data used as source for textures. See this section for an example on how to load an image into a portfolio.
HPS::TextureDefinition A description of how an image source will be applied to a given facetted surface. For more details on how to load and use textures, see this section.
HPS::LinePatternDefinition A description of how a line is rendered using patterned lines, glyphs, and end caps. Line patterns are discussed in this section.
HPS::MaterialPaletteDefinition A collection of materials that can be referenced by index. A palette can be used to apply materials to facetted geometry. Material palettes are discussed in this section.
HPS::CubeMapDefinition A texture definition composed of six images that correspond to the faces of a cube. Typically used to render background scenery with the viewpoint at the center of the cube. See the example in this section.

Most definitions are created by passing the corresponding kit to the portfolio where the definition will be contained. It is recommended that a descriptive name be used for the definition since all definitions are referred to by name. However, this is not a requirement and you can create nameless definitions by passing an empty string or null_ptr as the name.

After the resources are defined, they are accessible by any segment that is using the portfolio. Similarly, definitions can be undefined.

myPortfolio.DefineLinePattern("dashedLine", myLinePatternKit); // defines a line pattern
myPortfolio.DefineShader("superShader", myShaderKit); // defines a shader
myPortfolio.DefineNamedStyle("custom style", HPS::Database::CreateRootSegment()); // defines a style
myPortfolio.UndefineTexture("roughTexture"); // undefines a texture
myPortfolio.DefineLinePattern("dashedLine", myLinePatternKit); // defines a line pattern
myPortfolio.DefineShader("superShader", myShaderKit); // defines a shader
myPortfolio.DefineNamedStyle("custom style", HPS.Database.CreateRootSegment()); // defines a style
myPortfolio.UndefineTexture("roughTexture"); // undefines a texture



In addition to creating definitions, you can also import them from other portfolios. When importing, there are three layers of granularity. You can import all the definitions from a portfolio, all definitions for a specific category, or individual definitions. When you import definitions from another portfolio, use the portfolio key:

// imports all resources from 'otherPortfolio'
myPortfolio.ImportPortfolio(otherPortfolio);
// imports all textures from 'otherPortfolio'
myPortfolio.ImportAllTextures(otherPortfolio);
// imports a single glyph
myPortfolio.ImportGlyph(someGlyph);
// imports all resources from 'otherPortfolio'
myPortfolio.ImportPortfolio(otherPortfolio);
// imports all textures from 'otherPortfolio'
myPortfolio.ImportAllTextures(otherPortfolio);
// imports a single glyph
myPortfolio.ImportGlyph(someGlyph);



All of the Import functions have a second parameter which defaults to true. This flag controls whether the definitions that are being imported will replace the existing definitions.

myPortfolio.ImportAllTextures(otherPortfolio, true); // replaces existing definitions
myPortfolio.ImportAllTextures(otherPortfolio, false); // does not replace existing definitions
myPortfolio.ImportAllTextures(otherPortfolio, true); // replaces existing definitions
myPortfolio.ImportAllTextures(otherPortfolio, false); // does not replace existing definitions