Added line/triangle strip support (#5017)
* Added line/triangle strip support * Added strip support for Java and JS Changed README to indicate strip support for gltf
This commit is contained in:
@@ -151,9 +151,9 @@ steps:
|
||||
- [x] Points
|
||||
- [x] Lines
|
||||
- [ ] Line Loop
|
||||
- [ ] Line Strip
|
||||
- [x] Line Strip
|
||||
- [x] Triangles
|
||||
- [ ] Triangle Strip
|
||||
- [x] Triangle Strip
|
||||
- [ ] Triangle Fan
|
||||
|
||||
- Animation
|
||||
|
||||
@@ -96,7 +96,9 @@ public class RenderableManager {
|
||||
public enum PrimitiveType {
|
||||
POINTS(0),
|
||||
LINES(1),
|
||||
TRIANGLES(4);
|
||||
LINE_STRIP(3),
|
||||
TRIANGLES(4),
|
||||
TRIANGLE_STRIP(5);
|
||||
|
||||
private final int mType;
|
||||
PrimitiveType(int value) { mType = value; }
|
||||
|
||||
@@ -193,10 +193,12 @@ static constexpr size_t SHADER_MODEL_COUNT = 3;
|
||||
*/
|
||||
enum class PrimitiveType : uint8_t {
|
||||
// don't change the enums values (made to match GL)
|
||||
POINTS = 0, //!< points
|
||||
LINES = 1, //!< lines
|
||||
TRIANGLES = 4, //!< triangles
|
||||
NONE = 0xFF
|
||||
POINTS = 0, //!< points
|
||||
LINES = 1, //!< lines
|
||||
LINE_STRIP = 3, //!< line strip
|
||||
TRIANGLES = 4, //!< triangles
|
||||
TRIANGLE_STRIP = 5, //!< triangle strip
|
||||
NONE = 0xFF
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -304,7 +304,9 @@ constexpr inline MTLPrimitiveType getMetalPrimitiveType(PrimitiveType type) noex
|
||||
switch (type) {
|
||||
case PrimitiveType::POINTS: return MTLPrimitiveTypePoint;
|
||||
case PrimitiveType::LINES: return MTLPrimitiveTypeLine;
|
||||
case PrimitiveType::LINE_STRIP: return MTLPrimitiveTypeLineStrip;
|
||||
case PrimitiveType::TRIANGLES: return MTLPrimitiveTypeTriangle;
|
||||
case PrimitiveType::TRIANGLE_STRIP: return MTLPrimitiveTypeTriangleStrip;
|
||||
case PrimitiveType::NONE:
|
||||
ASSERT_POSTCONDITION(false, "NONE is not a valid primitive type.");
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ io::ostream& operator<<(io::ostream& out, ShaderModel model) {
|
||||
io::ostream& operator<<(io::ostream& out, PrimitiveType type) {
|
||||
switch (type) {
|
||||
CASE(PrimitiveType, TRIANGLES)
|
||||
CASE(PrimitiveType, TRIANGLE_STRIP)
|
||||
CASE(PrimitiveType, LINES)
|
||||
CASE(PrimitiveType, LINE_STRIP)
|
||||
CASE(PrimitiveType, POINTS)
|
||||
CASE(PrimitiveType, NONE)
|
||||
}
|
||||
|
||||
@@ -283,9 +283,15 @@ void VulkanRenderPrimitive::setPrimitiveType(backend::PrimitiveType pt) {
|
||||
case backend::PrimitiveType::LINES:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
break;
|
||||
case backend::PrimitiveType::LINE_STRIP:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
break;
|
||||
case backend::PrimitiveType::TRIANGLES:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
break;
|
||||
case backend::PrimitiveType::TRIANGLE_STRIP:
|
||||
primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,12 +122,16 @@ inline bool getPrimitiveType(cgltf_primitive_type in,
|
||||
case cgltf_primitive_type_lines:
|
||||
*out = filament::RenderableManager::PrimitiveType::LINES;
|
||||
return true;
|
||||
case cgltf_primitive_type_line_strip:
|
||||
*out = filament::RenderableManager::PrimitiveType::LINE_STRIP;
|
||||
return true;
|
||||
case cgltf_primitive_type_triangles:
|
||||
*out = filament::RenderableManager::PrimitiveType::TRIANGLES;
|
||||
return true;
|
||||
case cgltf_primitive_type_line_loop:
|
||||
case cgltf_primitive_type_line_strip:
|
||||
case cgltf_primitive_type_triangle_strip:
|
||||
*out = filament::RenderableManager::PrimitiveType::TRIANGLE_STRIP;
|
||||
return true;
|
||||
case cgltf_primitive_type_line_loop:
|
||||
case cgltf_primitive_type_triangle_fan:
|
||||
return false;
|
||||
}
|
||||
|
||||
2
web/filament-js/filament.d.ts
vendored
2
web/filament-js/filament.d.ts
vendored
@@ -824,7 +824,9 @@ export enum PixelDataType {
|
||||
export enum RenderableManager$PrimitiveType {
|
||||
POINTS,
|
||||
LINES,
|
||||
LINE_STRIP,
|
||||
TRIANGLES,
|
||||
TRIANGLE_STRIP,
|
||||
NONE,
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,9 @@ enum_<LightManager::Type>("LightManager$Type")
|
||||
enum_<RenderableManager::PrimitiveType>("RenderableManager$PrimitiveType")
|
||||
.value("POINTS", RenderableManager::PrimitiveType::POINTS)
|
||||
.value("LINES", RenderableManager::PrimitiveType::LINES)
|
||||
.value("LINE_STRIP", RenderableManager::PrimitiveType::LINE_STRIP)
|
||||
.value("TRIANGLES", RenderableManager::PrimitiveType::TRIANGLES)
|
||||
.value("TRIANGLE_STRIP", RenderableManager::PrimitiveType::TRIANGLE_STRIP)
|
||||
.value("NONE", RenderableManager::PrimitiveType::NONE);
|
||||
|
||||
enum_<View::QualityLevel>("View$QualityLevel")
|
||||
|
||||
Reference in New Issue
Block a user