jscad / csg.js

DEPRECATED: CSG Library for JSCAD (See the link below)
https://github.com/jscad/OpenJSCAD.org/tree/master/packages/modeling
MIT License
217 stars 56 forks source link

Feature Request:Retain the UV information of the geometry. #163

Closed FishOrBear closed 5 years ago

FishOrBear commented 5 years ago

In threecsg, Vertex expands the uv information and adds methods to achieve uv information reconstruction.

The code looks like this:

class Vertex extends Vector3
{
    constructor(
        pos: Vector3,
        public normal = new Vector3(),
        public uv = new Vector2())
    {
        super(pos.x, pos.y, pos.z);
    }

    clone(): Vertex
    {
        return new Vertex(this, this.normal.clone(), this.uv.clone());
    }

    lerp(v: Vertex, alpha: number)
    {
        super.lerp(v, alpha);
        this.normal.lerp(v.normal, alpha);
        this.uv.lerp(v.uv, alpha);
        return this;
    }
}

I am trying to implement this feature in csg.js.

FishOrBear commented 5 years ago

Since I will perform vertex merging now, I think I can only rebuild UV.