Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions crates/processing_pyo3/src/glfw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ impl GlfwContext {
}

#[cfg(target_os = "macos")]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing::prelude::surface_create_macos;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_macos(
self.window.get_cocoa_window() as u64,
width,
Expand All @@ -42,8 +43,9 @@ impl GlfwContext {
}

#[cfg(target_os = "windows")]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing::prelude::surface_create_windows;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_windows(
self.window.get_win32_window() as u64,
width,
Expand All @@ -53,8 +55,9 @@ impl GlfwContext {
}

#[cfg(all(target_os = "linux", feature = "wayland"))]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing::prelude::surface_create_wayland;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_wayland(
self.window.get_wayland_window() as u64,
self.glfw.get_wayland_display() as u64,
Expand All @@ -65,8 +68,9 @@ impl GlfwContext {
}

#[cfg(all(target_os = "linux", feature = "x11"))]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing::prelude::surface_create_x11;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_x11(
self.window.get_x11_window() as u64,
self.glfw.get_x11_display() as u64,
Expand Down
4 changes: 2 additions & 2 deletions crates/processing_pyo3/src/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ impl Gltf {
#[pyfunction]
#[pyo3(pass_module)]
pub fn load_gltf(module: &Bound<'_, PyModule>, path: &str) -> PyResult<Gltf> {
let graphics = get_graphics(module)?
.ok_or_else(|| PyRuntimeError::new_err("call size() first"))?;
let graphics =
get_graphics(module)?.ok_or_else(|| PyRuntimeError::new_err("call size() first"))?;
let entity =
gltf_load(graphics.entity, path).map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;
Ok(Gltf { entity })
Expand Down
2 changes: 1 addition & 1 deletion crates/processing_pyo3/src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl Graphics {
init(config).map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;

let surface = glfw_ctx
.create_surface(width, height, 1.0)
.create_surface(width, height)
.map_err(|e| PyRuntimeError::new_err(format!("{e}")))?;

let surface = Surface {
Expand Down
2 changes: 1 addition & 1 deletion crates/processing_pyo3/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use pyo3::{
};
use std::ffi::{CStr, CString};

use gltf::Gltf;
use bevy::log::warn;
use gltf::Gltf;
use std::env;

/// Get a shared ref to the Graphics context, or return Ok(()) if not yet initialized.
Expand Down
4 changes: 1 addition & 3 deletions examples/animated_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ fn sketch() -> error::Result<()> {

let width = 600;
let height = 600;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

let grid_size = 20;
Expand Down
4 changes: 1 addition & 3 deletions examples/background_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 400;
let height = 400;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;
let image = image_load("images/logo.png")?;

Expand Down
4 changes: 1 addition & 3 deletions examples/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 400;
let height = 400;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;
let box_geo = geometry_box(100.0, 100.0, 100.0)?;

Expand Down
4 changes: 1 addition & 3 deletions examples/custom_attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ fn sketch() -> error::Result<()> {

let width = 600;
let height = 600;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

let custom_attr = geometry_attribute_create("Custom", AttributeFormat::Float)?;
Expand Down
12 changes: 8 additions & 4 deletions examples/glfw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ impl GlfwContext {
}

#[cfg(target_os = "macos")]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing_render::surface_create_macos;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_macos(
self.window.get_cocoa_window() as u64,
width,
Expand All @@ -42,8 +43,9 @@ impl GlfwContext {
}

#[cfg(target_os = "windows")]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing_render::surface_create_windows;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_windows(
self.window.get_win32_window() as u64,
width,
Expand All @@ -53,8 +55,9 @@ impl GlfwContext {
}

#[cfg(all(target_os = "linux", feature = "wayland"))]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing_render::surface_create_wayland;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_wayland(
self.window.get_wayland_window() as u64,
self.glfw.get_wayland_display() as u64,
Expand All @@ -65,8 +68,9 @@ impl GlfwContext {
}

#[cfg(all(target_os = "linux", feature = "x11"))]
pub fn create_surface(&self, width: u32, height: u32, scale_factor: f32) -> Result<Entity> {
pub fn create_surface(&self, width: u32, height: u32) -> Result<Entity> {
use processing_render::surface_create_x11;
let (scale_factor, _) = self.window.get_content_scale();
surface_create_x11(
self.window.get_x11_window() as u64,
self.glfw.get_x11_display() as u64,
Expand Down
2 changes: 1 addition & 1 deletion examples/gltf_load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn sketch() -> error::Result<()> {
let mut glfw_ctx = GlfwContext::new(width, height)?;
init(Config::default())?;

let surface = glfw_ctx.create_surface(width, height, 1.0)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height)?;

let gltf = gltf_load(graphics, "gltf/Duck.glb")?;
Expand Down
4 changes: 1 addition & 3 deletions examples/lights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 400;
let height = 400;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;
let box_geo = geometry_box(100.0, 100.0, 100.0)?;
let pbr_mat = material_create_pbr()?;
Expand Down
2 changes: 1 addition & 1 deletion examples/materials.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn sketch() -> error::Result<()> {
let mut glfw_ctx = GlfwContext::new(width, height)?;
init(Config::default())?;

let surface = glfw_ctx.create_surface(width, height, 1.0)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;
let sphere = geometry_sphere(30.0, 32, 18)?;

Expand Down
4 changes: 1 addition & 3 deletions examples/midi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 400;
let height = 400;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

processing_midi::connect(0);
Expand Down
2 changes: 1 addition & 1 deletion examples/pbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn sketch() -> error::Result<()> {
let mut glfw_ctx = GlfwContext::new(width, height)?;
init(Config::default())?;

let surface = glfw_ctx.create_surface(width, height, 1.0)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

graphics_mode_3d(graphics)?;
Expand Down
4 changes: 1 addition & 3 deletions examples/rectangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 400;
let height = 400;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

while glfw_ctx.poll_events() {
Expand Down
2 changes: 1 addition & 1 deletion examples/transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn sketch() -> error::Result<()> {
let mut glfw_ctx = GlfwContext::new(400, 400)?;
init(Config::default())?;

let surface = glfw_ctx.create_surface(400, 400, 1.0)?;
let surface = glfw_ctx.create_surface(400, 400)?;
let graphics = graphics_create(surface, 400, 400, TextureFormat::Rgba16Float)?;

let mut t: f32 = 0.0;
Expand Down
4 changes: 1 addition & 3 deletions examples/update_pixels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ fn sketch() -> error::Result<()> {

let width = 100;
let height = 100;
let scale_factor = 1.0;

let surface = glfw_ctx.create_surface(width, height, scale_factor)?;
let surface = glfw_ctx.create_surface(width, height)?;
let graphics = graphics_create(surface, width, height, TextureFormat::Rgba16Float)?;

let rect_w = 10;
Expand Down
Loading