public class SoPattern extends SoNode
A pattern is a 32x32 bitmap that is interpreted as a mask of 0s and 1s. Where a 1 appears, the corresponding pixel in the polygon is drawn; where a 0 appears, nothing is drawn. Using patterns is like using screendoor transparency where you specify the pattern of the screen. OpenGL polygon stippling is used to render the pattern.
You can load a pattern file containing one or more patterns using the loadPatterns()
method. You can also define and load patterns programmatically using the addPattern()
method.
Here is a sample showing the pattern file format.
Note:"GEOLOGY" # The first string is the category name of the first pattern. # This is a comment ! "PATTERN N1" # The second string is the name of the pattern. # To define the pattern, you must define a 32x32 sequence of # '1' and '0'. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ... #============================================ "PATTERN N2" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ...
Usage Notes
File format/default:
Pattern {
category | "" |
name | "" |
NOTE: When you write a pattern node out to a file, the file will not contain enough information to fully reconstruct the original scene graph. The pattern node and its current fields are written out (as expected). However, the current fields only specify a category name and a pattern name. They do not specify the actual pattern(s) (like a typical attribute node) or a filename to get the patterns from (like a texture node).
See also:
Modifier and Type | Class and Description |
---|---|
static class |
SoPattern.FilterTypes
Possible value of the filterType used by the method loadPatterns.
|
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFString |
category
Specifies the name of a group of patterns.
|
static int |
EXCLUSIVE_FILTER
Deprecated.
Use
SoPattern.FilterTypes.EXCLUSIVE_FILTER instead. |
static int |
INCLUSIVE_FILTER
Deprecated.
Use
SoPattern.FilterTypes.INCLUSIVE_FILTER instead. |
SoSFString |
name
Specifies the name of a pattern within a category.
|
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoPattern()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
addPattern(java.lang.String category,
java.lang.String name,
byte[] bytes)
Adds a new pattern specified as an array of 128 bytes.
|
static java.lang.String[] |
getPatternNames()
Gets the list names of all loaded patterns.
|
static java.lang.String[] |
getPatternNames(java.lang.String category)
Gets the list names of all loaded patterns in the specified category.
|
static boolean |
loadPatterns(java.lang.String fileName)
Calls loadPatterns(fileName, (java.lang.String[])null, SoPattern.FilterTypes.valueOf( SoPattern.FilterTypes.INCLUSIVE_FILTER.getValue() )).
|
static boolean |
loadPatterns(java.lang.String fileName,
int numFilters)
Calls loadPatterns(fileName, numFilters, (java.lang.String[])null, SoPattern.FilterTypes.valueOf( SoPattern.FilterTypes.INCLUSIVE_FILTER.getValue() )).
|
static boolean |
loadPatterns(java.lang.String fileName,
int numFilters,
java.lang.String[] filterNames)
Calls loadPatterns(fileName, numFilters, filterNames, SoPattern.FilterTypes.valueOf( SoPattern.FilterTypes.INCLUSIVE_FILTER.getValue() )).
|
static boolean |
loadPatterns(java.lang.String fileName,
int numFilters,
java.lang.String[] filterNames,
SoPattern.FilterTypes filterType)
Loads a pattern file, with optional filtering of patterns.
|
static boolean |
loadPatterns(java.lang.String fileName,
java.lang.String[] filterNames)
Calls loadPatterns(fileName, filterNames, SoPattern.FilterTypes.valueOf( SoPattern.FilterTypes.INCLUSIVE_FILTER.getValue() )).
|
static boolean |
loadPatterns(java.lang.String fileName,
java.lang.String[] filterNames,
SoPattern.FilterTypes filterType)
Loads a pattern file, with optional filtering of patterns.
|
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int INCLUSIVE_FILTER
SoPattern.FilterTypes.INCLUSIVE_FILTER
instead.@Deprecated public static final int EXCLUSIVE_FILTER
SoPattern.FilterTypes.EXCLUSIVE_FILTER
instead.public final SoSFString category
public final SoSFString name
public static java.lang.String[] getPatternNames()
public static java.lang.String[] getPatternNames(java.lang.String category)
public static boolean loadPatterns(java.lang.String fileName, int numFilters, java.lang.String[] filterNames)
public static boolean loadPatterns(java.lang.String fileName)
public static boolean loadPatterns(java.lang.String fileName, java.lang.String[] filterNames)
public static boolean loadPatterns(java.lang.String fileName, int numFilters)
public static void addPattern(java.lang.String category, java.lang.String name, byte[] bytes)
public static boolean loadPatterns(java.lang.String fileName, java.lang.String[] filterNames, SoPattern.FilterTypes filterType)
filterNames is an array of pattern names. This will be an array of patterns to include (or exclude) depending on the FilterType. The size of this array is numFilters.
public static boolean loadPatterns(java.lang.String fileName, int numFilters, java.lang.String[] filterNames, SoPattern.FilterTypes filterType)
filterNames is an array of pattern names. This will be an array of patterns to include (or exclude) depending on the FilterType. The size of this array is numFilters.
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com