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

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

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

origin: javagl/JglTF

@Override
public int getComponentSizeInBytes()
{
  return Accessors.getNumBytesForAccessorComponentType(componentType);
}
 
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;
}
origin: javagl/JglTF

  GltfConstants.stringFor(accessor.getComponentType());
int componentSizeInBytes =
  Accessors.getNumBytesForAccessorComponentType(componentType);
int numComponents = 
  Accessors.getNumComponentsForAccessorType(accessor.getType());
de.javagl.jgltf.modelAccessorsgetNumBytesForAccessorComponentType

Javadoc

Returns the number of bytes that one component with the given accessor component type consists of. Valid parameters are
 
GL_BYTE           : 1 
GL_UNSIGNED_BYTE  : 1  
GL_SHORT          : 2  
GL_UNSIGNED_SHORT : 2  
GL_INT            : 4  
GL_UNSIGNED_INT   : 4  
GL_FLOAT          : 4 

Popular methods of Accessors

  • 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

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • JList (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • Top plugins for WebStorm
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