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

How to use
MeshPrimitive
in
de.javagl.jgltf.impl.v1

Best Java code snippets using de.javagl.jgltf.impl.v1.MeshPrimitive (Showing top 6 results out of 315)

origin: javagl/JglTF

MeshPrimitive meshPrimitive)
Integer mode = meshPrimitive.getMode();
if (mode == null)
  mode = meshPrimitive.defaultMode();
String indicesId = meshPrimitive.getIndices();
if (indicesId != null)
  Optionals.of(meshPrimitive.getAttributes());
for (Entry<String, String> entry : attributes.entrySet())
String materialId = meshPrimitive.getMaterial();
if (materialId == null ||
  GltfDefaults.isDefaultMaterialId(materialId))
origin: javagl/JglTF

/**
 * Create {@link Material} instances with random colors, and assign 
 * them to the given {@link MeshPrimitive} instances
 * 
 * @param meshPrimitives The {@link MeshPrimitive} instances
 * @param withNormals Whether the {@link MeshPrimitive} instances have
 * normal information
 */
private void assignRandomColorMaterials(
  Iterable<? extends MeshPrimitive> meshPrimitives, boolean withNormals)
{
  Random random = new Random(0);
  for (MeshPrimitive meshPrimitive : meshPrimitives)
  {
    float r = random.nextFloat(); 
    float g = random.nextFloat(); 
    float b = random.nextFloat(); 
    Material material = 
      mtlMaterialHandler.createMaterialWithColor(
        withNormals, r, g, b);
    String materialId = 
      GltfIds.generateId("material", gltf.getMaterials());
    gltf.addMaterials(materialId, material);
    meshPrimitive.setMaterial(materialId);
  }
}
 
origin: javagl/JglTF

String materialId = meshPrimitive.getMaterial();
      meshPrimitive.getAttributes();
    if (meshPrimitiveAttributes == null)
String indicesAccessorId = meshPrimitive.getIndices();
if (indicesAccessorId != null)
origin: javagl/JglTF

  new MeshPrimitive();
meshPrimitive.setMode(GltfConstants.GL_TRIANGLES);
  indicesAccessorId, indicesComponentType, "SCALAR", 
  createIndicesByteBuffer(part, indicesComponentType));
meshPrimitive.setIndices(indicesAccessorId);
  positionsAccessorId, GltfConstants.GL_FLOAT, "VEC3", 
  Buffers.createByteBufferFrom(objVertices));
meshPrimitive.addAttributes("POSITION", positionsAccessorId);
    texCoordsAccessorId, GltfConstants.GL_FLOAT, "VEC2", 
    Buffers.createByteBufferFrom(objTexCoords));
  meshPrimitive.addAttributes("TEXCOORD_0", texCoordsAccessorId);
    normalsAccessorId, GltfConstants.GL_FLOAT, "VEC3", 
    Buffers.createByteBufferFrom(objNormals));
  meshPrimitive.addAttributes("NORMAL", normalsAccessorId);
origin: javagl/JglTF

/**
 * Create a default {@link Material}, and assign it to all the given 
 * {@link MeshPrimitive} instances
 * 
 * @param meshPrimitives The {@link MeshPrimitive} instances
 * @param withNormals Whether the {@link MeshPrimitive} instances have
 * normal information
 */
private void assignDefaultMaterial(
  Iterable<? extends MeshPrimitive> meshPrimitives, boolean withNormals)
{
  Material material = mtlMaterialHandler.createMaterialWithColor(
    withNormals, 0.75f, 0.75f, 0.75f);
  String materialId = 
    GltfIds.generateId("material", gltf.getMaterials());
  gltf.addMaterials(materialId, material);
  for (MeshPrimitive meshPrimitive : meshPrimitives)
  {
    meshPrimitive.setMaterial(materialId);
  }
}
origin: javagl/JglTF

/**
 * Create a {@link Material} for the given OBJ and MTL, and assign it
 * to all the given {@link MeshPrimitive} instances
 * 
 * @param meshPrimitives The {@link MeshPrimitive} instances
 * @param obj The OBJ
 * @param mtl The MTL
 */
private void assignMaterial(
  Iterable<? extends MeshPrimitive> meshPrimitives, 
  ReadableObj obj, Mtl mtl)
{
  Material material = mtlMaterialHandler.createMaterial(obj, mtl);
  String materialId = 
    GltfIds.generateId("material", gltf.getMaterials());
  gltf.addMaterials(materialId, material);
  for (MeshPrimitive meshPrimitive : meshPrimitives)
  {
    meshPrimitive.setMaterial(materialId);
  }
}
 
de.javagl.jgltf.impl.v1MeshPrimitive

Javadoc

Geometry to be rendered with the given material. Auto-generated for mesh.primitive.schema.json

Most used methods

  • getAttributes
    A dictionary object of strings, where each string is the ID of the accessor containing an attribute.
  • getIndices
    The ID of the accessor that contains the indices. (optional)
  • getMaterial
    The ID of the material to apply to this primitive when rendering. (required)
  • <init>
  • addAttributes
    Add the given attributes. The attributes of this instance will be replaced with a map that contains
  • defaultMode
    Returns the default value of the mode
  • getMode
    The type of primitives to render. (optional) Default: 4 Valid values: [0, 1, 2, 3, 4, 5, 6]
  • setIndices
    The ID of the accessor that contains the indices. (optional)
  • setMaterial
    The ID of the material to apply to this primitive when rendering. (required)
  • setMode
    The type of primitives to render. (optional) Default: 4 Valid values: [0, 1, 2, 3, 4, 5, 6]

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Collectors (java.util.stream)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
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