How to use the pyrender.scene.View.View.create_from_setting function in pyrender

To help you get started, we’ve selected a few pyrender examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qnzhou / PyRenderer / pyrender / scene / Scene.py View on Github external
def __initialize_views(self, setting):
        setting = self.__remove_relative_mesh_path(setting);
        view_configs = setting.get("views");
        views = [View.create_from_setting(view_setting)
                for view_setting in view_configs];
        self.views = [];
        for view in views:
            if isinstance(view, list):
                self.views += view;
            else:
                self.views.append(view);
        self.activate_view();
        self.__compute_global_transform();
github qnzhou / PyRenderer / pyrender / scene / CompositeView.py View on Github external
{
            "type": "composite",
            "views": [
                {
                    # other views
                },
                {
                    # other views
                },
            "unified_deform_magnitude": scalar
            ]
        }
        """
        views = [];
        for view_setting in setting["views"]:
            view = View.create_from_setting(view_setting);
            if not isinstance(view, View):
                raise RuntimeError(
                        "Subview of composite view must be a simple view!");
            views.append(view);
        instance = CompositeView(views);
        return instance;
github qnzhou / PyRenderer / pyrender / scene / TextureView.py View on Github external
def create_from_setting(cls, setting):
        """ syntax:
        {
            "type": "texture",
            "uv_attribute": "corner_texture",
            "uv_scale": float,
            "uv_offset": [0.0, 0.0],
            "with_boundary": bool,
            "boundary_color": color_name,
            "boundary_radius": radius
            "view": {
                ...
            }
        }
        """
        nested_view = View.create_from_setting(setting["view"]);
        instance = TextureView(nested_view);
        instance.uv_scale = setting.get("uv_scale", 1.0);
        instance.uv_offset = setting.get("uv_offset", [0.0, 0.0]);
        instance.uv_attribute = setting.get("uv_attribute", "corner_texture");
        instance.with_boundary = setting.get("with_boundary", True);
        instance.boundary_radius = setting.get("boundary_radius", 0.002);
        instance.boundary_color = setting.get("boundary_color", None);
        if instance.with_boundary:
            instance.extract_texture_boundary();
        return instance;
github qnzhou / PyRenderer / pyrender / scene / SphereView.py View on Github external
def create_from_setting(cls, setting):
        """ Syntax:
        {
            "type": "sphere",
            "scalar": scalar_field,
            "color_map": color_map,
            "radius_range": [min_radius, max_radius],
            "bounds": [min_val, max_val], # use None if not needed
            "view": {
                ...
            }
        }
        """
        nested_view = View.create_from_setting(setting["view"]);
        instance = SphereView(nested_view, setting["scalar"]);
        instance.color_map = setting.get("color_map", "jet");
        instance.radius_range = setting["radius_range"];
        instance.bounds = setting.get("bounds", [None, None]);
        instance.generate_primitives();
        return instance;
github qnzhou / PyRenderer / pyrender / scene / ClippedView.py View on Github external
def create_from_setting(cls, setting):
        """ syntax:
        {
            "type": "clipped",
            "plane": +X,+Y,+Z,-X,-Y,-Z, or [nx, ny, nz, o]
                s.t. the plane define is nx*x + ny*y + nz*z < o
            "cut_ratio": float between 0 and 1,
            "interior_color": "color_name"
            "view": {
                ...
            }
        }
        """
        nested_view = View.create_from_setting(setting["view"]);
        instance = ClippedView(nested_view, setting["plane"],
                setting.get("interior_color", "blue"),
                setting.get("exterior_color", "yellow"),
                setting.get("cut_ratio", 0.5));
        return instance;
github qnzhou / PyRenderer / pyrender / scene / DeformationView.py View on Github external
def create_from_setting(cls, setting):
        """ syntax:
        {
            "type": "deformation",
            "vector": vector_field,
            "deform_magnitude": scalar,
            "deform_factor": scalar,
            "view": {
                ...
            }
        }
        """
        nested_view = View.create_from_setting(setting["view"]);
        instance = DeformationView(nested_view, setting["vector"]);
        instance.deformation_magnitude = setting.get("deform_magnitude",
                instance.deformation_magnitude);
        instance.deformation_factor = setting.get("deform_factor",
                instance.deformation_factor);
        instance.compute_deformed_vertices();
        return instance;