Tabnine Logo
Accessors
Code IndexAdd Tabnine to your IDE (free)

How to use
Accessors
in
de.javagl.jgltf.model

Best Java code snippets using de.javagl.jgltf.model.Accessors (Showing top 7 results out of 315)

origin: javagl/JglTF

@Override
public int getComponentSizeInBytes()
{
  return Accessors.getNumBytesForAccessorComponentType(componentType);
}
 
origin: javagl/JglTF

@Override
public Class<?> getComponentDataType()
{
  return Accessors.getDataTypeForAccessorComponentType(
    getComponentType());
}
 
origin: javagl/JglTF

  GltfConstants.stringFor(accessor.getComponentType());
int componentSizeInBytes =
  Accessors.getNumBytesForAccessorComponentType(componentType);
int numComponents = 
  Accessors.getNumComponentsForAccessorType(accessor.getType());
int elementSizeInBytes = numComponents * componentSizeInBytes;
origin: javagl/JglTF

/**
 * Create a byte buffer containing the data of the indices for the
 * given OBJ. The face vertex indices of the given OBJ will be 
 * extracted (assuming that it contains only triangles), converted
 * to the given indices component type (which is a GL constant like
 * GL_SHORT), and a byte buffer containing these indices will be returned.
 * 
 * @param obj The OBJ
 * @param indicesComponentType The indices component type
 * @return The byte buffer
 */
private static ByteBuffer createIndicesByteBuffer(
  ReadableObj obj, int indicesComponentType)
{
  int numVerticesPerFace = 3;
  IntBuffer objIndices = 
    ObjData.getFaceVertexIndices(obj, numVerticesPerFace);
  int indicesComponentSize =
    Accessors.getNumBytesForAccessorComponentType(
      indicesComponentType);
  ByteBuffer indicesByteBuffer = 
    IntBuffers.convertToByteBuffer(objIndices, indicesComponentSize);
  return indicesByteBuffer;
}
 
origin: javagl/JglTF

/**
 * Create a byte buffer containing the data of the indices for the
 * given OBJ. The face vertex indices of the given OBJ will be 
 * extracted (assuming that it contains only triangles), converted
 * to the given indices component type (which is a GL constant like
 * GL_SHORT), and a byte buffer containing these indices will be returned.
 * 
 * @param obj The OBJ
 * @param indicesComponentType The indices component type
 * @return The byte buffer
 */
private static ByteBuffer createIndicesByteBuffer(
  ReadableObj obj, int indicesComponentType)
{
  int numVerticesPerFace = 3;
  IntBuffer objIndices = 
    ObjData.getFaceVertexIndices(obj, numVerticesPerFace);
  int indicesComponentSize =
    Accessors.getNumBytesForAccessorComponentType(
      indicesComponentType);
  ByteBuffer indicesByteBuffer = 
    IntBuffers.convertToByteBuffer(objIndices, indicesComponentSize);
  return indicesByteBuffer;
}
 
origin: javagl/JglTF

/**
 * Create an {@link AccessorModel} in the {@link BufferStructure} that 
 * is currently being built.
 * 
 * @param id The ID of the {@link AccessorModel}
 * @param componentType The component type, as a GL constant
 * @param type The type of the data, as a string corresponding to
 * the {@link ElementType} of the accessor
 * @param byteBuffer The actual data
 */
public void createAccessorModel(String id,
  int componentType, String type, ByteBuffer byteBuffer)
{
  ElementType elementType = ElementType.valueOf(type);
  int numComponents = elementType.getNumComponents();
  int numBytesPerComponent = 
    Accessors.getNumBytesForAccessorComponentType(componentType);
  int numBytesPerElement = numComponents * numBytesPerComponent;
  int count = byteBuffer.capacity() / numBytesPerElement;
  DefaultAccessorModel accessorModel = new DefaultAccessorModel(
    componentType, count, elementType);
  bufferStructure.addAccessorModel(accessorModel, id);
  currentAccessorModels.add(accessorModel);
  rawAccessorModelByteBuffers.put(accessorModel, byteBuffer);
}
 
origin: javagl/JglTF

/**
 * Create a {@link DefaultAccessorModel} for the given {@link Accessor}
 * 
 * @param accessor The {@link Accessor}
 * @return The {@link AccessorModel}
 */
private static DefaultAccessorModel createAccessorModel(Accessor accessor)
{
  Integer componentType = accessor.getComponentType();
  Integer byteOffset = accessor.getByteOffset();
  Integer count = accessor.getCount();
  ElementType elementType = ElementType.forString(accessor.getType());
  Integer byteStride = accessor.getByteStride();
  if (byteStride == null)
  {
    byteStride = elementType.getNumComponents() *
      Accessors.getNumBytesForAccessorComponentType(
        componentType);
  }
  DefaultAccessorModel accessorModel = new DefaultAccessorModel(
    componentType, count, elementType);
  accessorModel.setByteOffset(byteOffset);
  accessorModel.setByteStride(byteStride);
  return accessorModel;
}
de.javagl.jgltf.modelAccessors

Javadoc

Utility methods related to accessor properties.

Unless otherwise noted, none of the arguments to these methods may be null.

Most used methods

  • getNumBytesForAccessorComponentType
    Returns the number of bytes that one component with the given accessor component type consists of. V
  • getDataTypeForAccessorComponentType
    Returns the data type for the given accessor component type. Valid parameters and their return value
  • getNumComponentsForAccessorType
    Returns the number of components that one element has for the given accessor type. Valid parameters

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now