Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(The added lines count is huge since this adds a docusaurus-based website for kiss3d too, including some assets.)
v0.39.0
Major API overhaul: scene separation from window, glam math library, simplified transform API, and 2D/3D naming conventions.
Breaking Changes
Scene Separation from Window
window.render_3d(&mut scene, &mut camera)andwindow.render_2d(&mut scene, &mut camera)window.add_cube(),window.add_sphere(), etc. - usescene.add_cube()insteadwindow.scene()andwindow.scene_mut()- manage scenes directly3D Type Renaming
SceneNode→SceneNode3dObject→Object3dGpuMesh→GpuMesh3dMeshManager→MeshManager3dMaterialManager→MaterialManager3dPointRenderer→PointRenderer3dPolylineRenderer→PolylineRenderer3dCameratrait →Camera3dtraitMath Library: nalgebra → glam
nalgebratoglamx(glam wrapper) for all public APIsPoint3<f32>→Vec3Vector3<f32>→Vec3UnitQuaternion<f32>→QuatTranslation3<f32>→Vec3Isometry3<f32>→Pose3Point2<f32>/Vector2<f32>→Vec2UnitComplex<f32>→f32(just use angle in radians directly)Vector3::y_axis()→Vec3::YPoint3::origin()→Vec3::ZEROUnitQuaternion::from_axis_angle(&Vector3::y_axis(), angle)→Quat::from_axis_angle(Vec3::Y, angle)Simplified Transform API
prepend_to_local_rotation(&rot)→rotate(rot)prepend_to_local_translation(&t)→translate(t)set_local_rotation(r)→set_rotation(r)set_local_translation(t)→set_position(t)local_rotation()→rotation()local_translation()→position()2D API Renaming ("planar" → "2d")
PlanarSceneNode→SceneNode2dPlanarCamera→Camera2dFixedView(planar) →FixedView2dSidescroll→PanZoomCamera2ddraw_planar_line()→draw_line_2d()draw_planar_point()→draw_point_2d()add_rectangle()/add_circle()now onSceneNode2dplanar_camera→camera2d,planar_polyline_renderer→polyline_renderer2dCamera Renaming
ArcBall→OrbitCamera3dFirstPerson→FirstPersonCamera3dFirstPersonStereo→FirstPersonStereoCamera3dFixedView→FixedViewCamera3dColor API
[f32; 3]arrays instead ofPoint3<f32>set_color(r, g, b)now takes a[f32; 3]and you can use color constants directly:set_color(RED)set_lines_color(Some(Point3::new(1.0, 0.0, 0.0)))→set_lines_color(Some(RED))colormodule with CSS named color constants (re-exported in prelude)parry3d Now Optional
parry3dmoved behindparryfeature flagparry3dnow uses glam directly (no nalgebra conversion needed)add_trimesh()requiresparryfeatureproceduralanddecomprequire--features parryLighting API
Light::Absolute(Point3)andLight::StickToCameraenum with newLightstructwindow.set_light()- usescene.add_light()insteadOther Breaking Changes
SceneNode::new_empty()→SceneNode3d::empty()SceneNode::unlink()→SceneNode3d::detach()u32(removedvertex_index_u32feature)instantcrate replaced withweb_timecamera2dandcamera3dnow under singlecameramoduleWindow::set_frame_limit()methodset_background_color(r, g, b)→set_background_color(Color)draw_line(a, b, color, width)→draw_line(a, b, color, width, perspective)Migration Guide
Basic 3D scene (before):
Basic 3D scene (after):
Basic 2D scene (before):
Basic 2D scene (after):
New Features
Multiple Lights Support
Light::point(),Light::directional(),Light::spot()scene.add_light(light)add_point_light(),add_directional_light(),add_spot_light()color,intensity,enabled,attenuation_radiusLight::point(100.0).with_color(RED).with_intensity(5.0)Ambient Light Control
window.set_ambient(f32)- set ambient light intensitywindow.ambient()- get current ambient light intensityColor Module
kiss3d::colormodule with all CSS named colorscolor::RED,color::LIME_GREEN,color::STEEL_BLUEColorstruct (alias ofRgba<f32>) for colors with alpha channelSubdivision Control for Primitives
add_sphere_with_subdiv(r, ntheta, nphi)- control sphere tessellationadd_cone_with_subdiv(r, h, nsubdiv)- control cone segmentsadd_cylinder_with_subdiv(r, h, nsubdiv)- control cylinder segmentsadd_capsule_with_subdiv(r, h, ntheta, nphi)- control capsule tessellationOptional Serde Support
serdefeature flag for serialization supportkiss3d = { version = "0.39", features = ["serde"] }Default Cameras
OrbitCamera3d::default()- starts at (0, 0, -2) looking at originPanZoomCamera2d::default()- centered at origin with 2x zoomMulti-Window Support Improvements
Line Rendering
draw_line()now takes aperspectiveparameter to control size scaling with distance