Files
tinyusdz/tests/usda/usdlux_mesh_lights_simple.usda
Syoyo Fujita ab0ef8900c Add comprehensive UsdLux parsing and conversion system with test suite
Implements complete UsdLux light parsing and conversion pipeline:

Core Infrastructure:
- RenderLight data structure supporting 6 UsdLux light types (Point/Sphere, Directional, Rect, Disk, Cylinder, Dome)
- MeshLightAPI support for emissive geometry lights
- Full property extraction: color, intensity, exposure, shadows, shaping, IES profiles
- Color temperature support with Kelvin-based specification

JSON Serialization:
- Complete light data serialization in material-serializer.cc
- Geometry light mesh references with geometryMeshId
- Material sync mode for mesh lights

Three.js Exporter:
- Light type conversion to Three.js equivalents
- Shadow map configuration
- Directional/Point/Spot/Rect/Hemisphere light export

WASM Bindings:
- numLights() API for light count
- getLightWithFormat() supporting JSON/YAML output
- Node.js CLI tool (dump-usdlux-cli.js) for testing

Test Suite:
- Comprehensive test files in tests/usda/:
  * usdlux_basic_lights.usda - 6 light types
  * usdlux_advanced_features.usda - IES, shaping, textures
  * usdlux_mesh_lights_simple.usda - MeshLightAPI
- Automated test suite (test-usdlux-parsing.js)
- npm test:usdlux script for CI/CD integration
- All tests passing (4/4)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-19 03:27:19 +09:00

111 lines
3.2 KiB
Plaintext

#usda 1.0
(
doc = "Simple MeshLightAPI test - Emissive geometry as light sources"
defaultPrim = "World"
metersPerUnit = 1
upAxis = "Y"
)
def Xform "World"
{
def Scope "Lights"
{
# Simple emissive cube (mesh light)
def Mesh "EmissiveCube" (
apiSchemas = ["MeshLightAPI"]
)
{
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [
0, 1, 3, 2, # Front
4, 5, 7, 6, # Back
0, 4, 6, 2, # Left
1, 5, 7, 3, # Right
0, 1, 5, 4, # Bottom
2, 3, 7, 6 # Top
]
point3f[] points = [
(-0.5, -0.5, -0.5), (0.5, -0.5, -0.5), # Bottom
(-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), # Top front
(-0.5, -0.5, 0.5), (0.5, -0.5, 0.5), # Bottom back
(-0.5, 0.5, 0.5), (0.5, 0.5, 0.5) # Top back
]
# MeshLightAPI properties
float inputs:intensity = 50.0
color3f inputs:color = (1.0, 0.8, 0.6)
bool inputs:normalize = true
double3 xformOp:translate = (0, 2, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
# Emissive rectangle (simple quad mesh light)
def Mesh "LightPanel" (
apiSchemas = ["MeshLightAPI"]
)
{
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 2, 3]
point3f[] points = [
(-1.0, 0, -0.5),
(1.0, 0, -0.5),
(1.0, 0, 0.5),
(-1.0, 0, 0.5)
]
normal3f[] normals = [
(0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0)
] (
interpolation = "vertex"
)
# MeshLightAPI properties
float inputs:intensity = 100.0
color3f inputs:color = (0.9, 0.95, 1.0)
bool inputs:normalize = false
# Material sync mode
token inputs:materialSyncMode = "independent"
double3 xformOp:translate = (0, 3.5, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
# Standard sphere light for comparison
def SphereLight "StandardLight"
{
color3f inputs:color = (1.0, 1.0, 1.0)
float inputs:intensity = 75.0
float inputs:radius = 0.3
double3 xformOp:translate = (-3, 2, 2)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
}
# Reference geometry
def Xform "Scene"
{
def Sphere "TestSphere"
{
double radius = 0.8
double3 xformOp:translate = (0, 0.8, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
}
def Mesh "Floor"
{
int[] faceVertexCounts = [4]
int[] faceVertexIndices = [0, 1, 2, 3]
point3f[] points = [
(-5, 0, -5), (5, 0, -5), (5, 0, 5), (-5, 0, 5)
]
normal3f[] normals = [
(0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)
] (
interpolation = "vertex"
)
}
}
}