Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Share Thread:
Reddit Facebook Twitter
Want to finalize a new wings_we:build for colors.
10-22-2014, 11:25 PM (This post was last modified: 10-22-2014 11:31 PM by ggaliens.)
Post: #3
RE: Want to finalize a new wings_we:build for colors.
Micheus. You have some good ideas and observations. I will use array:fold

Anyways ... your code is not finding Color . That is one the the problems. I'm using a GbTree now
to do it faster instead of lists:nth. lists nth is just tad slow.

Little bit better ... maybe. I should maybe check that Vs and Vc are of equal length !
I was able to get the PLY vertex colors to work very easily because standard import codes
are doing a bunch of work ... so I want to fix it in a general way ... you know ... and do a pull request if I can get it done just right. Then I can also update WRL importer (old I know).

Code:
build(Mode, #e3d_mesh{fs=Fs0,vs=Vs,tx=Tx,he=He,vc=[{_R,_G,_B}|_]=Vc}) when is_atom(Mode) ->
    Fs = translate_faces(Fs0, list_to_tuple(Tx), []),
    #we{vp=VPos} = We = wings_we_build:we(Fs, Vs, He),
    Dict = lists:zip(lists:seq(0,length(Vc)-1), Vc),
    Tree = gb_trees:from_orddict(Dict),
    MyAcc = fun(Vi,_VAL, Acc) ->
         wings_va:set_vertex_color(gb_sets:singleton(Vi),gb_trees:get(Vi,Tree), Acc)
    end,
    We1 = array:fold(MyAcc, We, VPos),
    wings_we:renumber(We1,0);
Reply


Messages In This Thread
RE: Want to finalize a new wings_we:build for colors. - ggaliens - 10-22-2014 11:25 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)