Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CartoonEdgeFilter failing to override read() and write() #1640

Closed
capdevon opened this issue Nov 5, 2021 · 5 comments · Fixed by #1647
Closed

CartoonEdgeFilter failing to override read() and write() #1640

capdevon opened this issue Nov 5, 2021 · 5 comments · Fixed by #1647
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug" Easy first fix
Milestone

Comments

@capdevon
Copy link
Contributor

capdevon commented Nov 5, 2021

CartoonEdgeFilter class does not override read() and write()

    @Override
    public void write(JmeExporter ex) throws IOException {
        super.write(ex);
        OutputCapsule oc = ex.getCapsule(this);
        ...
    }

    @Override
    public void read(JmeImporter im) throws IOException {
        super.read(im);
        InputCapsule ic = im.getCapsule(this);
        ...
    }
@stephengold
Copy link
Member

Thanks for documenting the issue!

@stephengold stephengold added this to the v3.5.0 milestone Nov 5, 2021
@stephengold
Copy link
Member

Do you also plan to submit a fix?

@stephengold stephengold added defect Something that is supposed to work, but doesn't. Less severe than a "bug" Easy first fix labels Nov 6, 2021
@capdevon
Copy link
Contributor Author

capdevon commented Nov 6, 2021

I think the code to add is this. I prefer to let you complete the optimizations, you are more experienced than me :)

    @Override
    public void write(JmeExporter ex) throws IOException {
        super.write(ex);
        OutputCapsule oc = ex.getCapsule(this);
        oc.write(edgeWidth, "edgeWidth", 1.0f);
        oc.write(edgeIntensity, "edgeIntensity", 1.0f);
        oc.write(normalThreshold, "normalThreshold", 0.5f);
        oc.write(depthThreshold, "depthThreshold", 0.1f);
        oc.write(normalSensitivity, "normalSensitivity", 1.0f);
        oc.write(depthSensitivity, "depthSensitivity", 10.0f);
        oc.write(edgeColor, "edgeColor", ColorRGBA.Black);
    }

    @Override
    public void read(JmeImporter im) throws IOException {
        super.read(im);
        InputCapsule ic = im.getCapsule(this);
        edgeWidth = ic.readFloat("edgeWidth", 1.0f);
        edgeIntensity = ic.readFloat("edgeIntensity", 1.0f);
        normalThreshold = ic.readFloat("normalThreshold", 0.5f);
        depthThreshold = ic.readFloat("depthThreshold", 0.1f);
        normalSensitivity = ic.readFloat("normalSensitivity", 1.0f);
        depthSensitivity = ic.readFloat("depthSensitivity", 10.0f);
        edgeColor = (ColorRGBA) ic.readSavable("edgeColor", ColorRGBA.Black.clone());
    }

@stephengold
Copy link
Member

Would you like to gain experience?

@capdevon
Copy link
Contributor Author

capdevon commented Nov 8, 2021

I can try. Write me the details on the forum in private chat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something that is supposed to work, but doesn't. Less severe than a "bug" Easy first fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants