Vectorial texture and normal map creator

Everything related to 3D programming
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Vectorial texture and normal map creator

Post by minimy »

Hello, i want share this useful code to generate textures and normal map.

Advantages:
Same texture maked two times are diferent.
Small code to generate big textures.
Antialias for all elements.
Texture and normal map are generated.
Admit texts, boxes, circles, ellipses, blocks, stones and more.
PB native (must work in Linux and mac)
Low price 0.0€ :lol:
No sugar content.. :mrgreen:

Disvantages:
Need speedy pc if you generate many textures.

Watch examples to get an idea how work it.
I hope you enjoy this code.
If you improve this, please share the code.

Code: Select all

; Vectorial texture and normal map creator [minimy2025]

Procedure   showImage(img)
  If IsImage(img)
    SetWindowColor(OpenWindow(#PB_Any,0,0,ImageWidth(img),ImageHeight(img),"Test imagen: "+Str(img)) , $ff0000)
    ImageGadget(#PB_Any,0,0,ImageWidth(img),ImageHeight(img),ImageID(img))
  EndIf
EndProcedure

;{ data
Procedure   ImgToNormalMap(image, strength.f=1.0, invertX.b=#False, invertY.b=#False)
  Protected.f deltaX,deltaY
  Protected.l gleft,gRight,gUp,gDown
  Protected.c x,y
  Protected.a r,g,b
  Protected   normalMapID
  Protected.c width = ImageWidth(image)
  Protected.c height = ImageHeight(image)
  Protected.f nx,ny,nz,length
  Protected.l Dim px(width,height)
  StartDrawing(ImageOutput(image))
  For y = 1 To height - 2
    For x = 1 To width - 2
      If invertX
        gleft=  Point(x+1,y): gRight= Point(x-1,y)
      Else
        gleft=  Point(x-1,y): gRight= Point(x+1,y)
      EndIf
      deltaX = ((Red(gRight) + Green(gRight) + Blue(gRight)) / 3.0) - ((Red(gLeft) + Green(gLeft) + Blue(gLeft)) / 3.0)
      If invertY
        gUp=    Point(x,y+1): gDown=  Point(x,y-1)
      Else
        gUp=    Point(x,y-1): gDown=  Point(x,y+1)
      EndIf
      deltaY = ((Red(gDown) + Green(gDown) + Blue(gDown)) / 3.0) - ((Red(gUp) + Green(gUp) + Blue(gUp)) / 3.0)
      nx = deltaX * strength: ny = deltaY * strength: nz = 1.0
      length = Sqr(nx*nx + ny*ny + nz*nz): nx = nx / length: ny = ny / length: nz = nz / length
;       r = Int((nx + 1) * 127.5):g = Int((ny + 1) * 127.5): b = Int((nz + 1) * 127.5)
      r = (nx + 1) * 127.5:g = (ny + 1) * 127.5: b = (nz + 1) * 127.5
      px(x,y)= RGB(r, g, b)
    Next x
  Next y
  StopDrawing()
  normalMapID = CreateImage(#PB_Any, width, height, 32)
  StartDrawing(ImageOutput(normalMapID))
  For y = 1 To height - 2
    For x = 1 To width - 2
      Plot(x,y,px(x,y))
    Next x
  Next y
  StopDrawing()
  FreeArray(px())
  ProcedureReturn normalMapID
EndProcedure

Structure dvtItem_stru
  type.a
  x.f
  y.f
  w.f
  h.f
  color.l
  level.b
  txt.s
  p1.i        ;parametros multifunción
  p2.i
  fontName.s
  fontSize.c
  
  font.i      ;uso interno, luego se eliminan
  randSeed.i
EndStructure
Structure dvtData_stru
  name.s
  width.c
  height.c
  bumpForce.f
  texture.i
  normal.i
  imgTexture.i
  imgBump.i
  List o.dvtItem_stru()
EndStructure
Global NewList dvt.dvtData_stru()
;}

Procedure   dvtData(t.s, freeimg.b=#True)
  Protected.s txt, ts,os, comand
  Protected   tt,tn,ot,on, f, kx,ky
  Protected.f scale
  ;dibujado
  Protected   mode, n,loopN= 1, p,k,na
  Protected.f x,y,w,h, ox,oy,oh,ow
  Protected   img,bum,nor,noi
  Protected.f bx,by,bw,bh, rc, sep, nx,ny,nw,nh, ang
  
  tt= CountString(t,"#")
  For tn= 1 To tt
    ts= StringField(t,tn,"#")
    ot= CountString(ts,"|")
    AddElement(dvt())
    os= StringField(ts,1,"|")
    scale=            ValF(StringField(os,5,",")):If scale=0:scale=1:EndIf
    dvt()\name=       StringField(os,1,",")
    dvt()\width=      Val(StringField(os,2,",")) * scale
    dvt()\height=     Val(StringField(os,3,",")) * scale
    dvt()\bumpForce=  ValF(StringField(os,4,",")): If dvt()\bumpForce=0:dvt()\bumpForce=0.8:EndIf
    For on= 2 To ot
      os= StringField(ts,on,"|")
      comand= UCase(StringField(os,1,","))
      AddElement(dvt()\o())
      Select comand
        Case "BOX"
          dvt()\o()\type= 0
        Case "ROUNDBOX"
          dvt()\o()\type= 1
        Case "ELLIPSE"
          dvt()\o()\type= 2
        Case "LINE"
          dvt()\o()\type= 3
        Case "TEXT"
          dvt()\o()\type= 4
        Case "SHAPE"
          dvt()\o()\type= 5
        Case "TEXTBOX"
          dvt()\o()\type= 6
        Case "BRIK"
          dvt()\o()\type= 7
        Case "WOOD"
          dvt()\o()\type= 8
          
        Case "SPLASH"
          dvt()\o()\type= 9
        Case "DIRTY"
          dvt()\o()\type= 10
        Case "DIRTYPOINT"
          dvt()\o()\type= 11
        Case "RAYS"
          dvt()\o()\type= 12
        Case "LEAFS"
          dvt()\o()\type= 13
        Case "NOISE"
          dvt()\o()\type= 14
        Case "RADIALBOX"
          dvt()\o()\type= 15
        Case "GLASS"
          dvt()\o()\type= 16
        Case "STONE"
          dvt()\o()\type= 17
        Case "RADIALROUNDBOX"
          dvt()\o()\type= 18
          
        Case "LOOP"
          dvt()\o()\type= 100
      EndSelect
      dvt()\o()\x=        Val(StringField(os,2,","))
      dvt()\o()\y=        Val(StringField(os,3,","))
      dvt()\o()\w=        Val(StringField(os,4,","))
      dvt()\o()\h=        Val(StringField(os,5,","))
      dvt()\o()\color=    Val(StringField(os,6,","))
      dvt()\o()\level=    Val(StringField(os,7,","))
      dvt()\o()\txt=          StringField(os,8,",")
      dvt()\o()\p1=       Val(StringField(os,9,","))
      dvt()\o()\p2=       Val(StringField(os,10,","))
      dvt()\o()\fontName=     StringField(os,11,",")
      dvt()\o()\fontSize= Val(StringField(os,12,","))
;       If UCase(StringField(os,10,","))="R":dvt()\o()\p2=Random(Val( Right(StringField(os,10,","), Len(StringField(os,10,","))-1 ))):EndIf
;       If UCase(StringField(os,10,","))="R-":dvt()\o()\p2=-Random(Val(StringField(os,10,","))):EndIf

      If Left(StringField(os,6,","),1)= "R"
        dvt()\o()\color= Random( Val(Right(StringField(os,6,","), Len(StringField(os,6,","))-1)),1)
      EndIf
      If dvt()\o()\type <> 7
        If dvt()\o()\type= 0
          If Left(UCase(StringField(os,9,",")),1)="R" And Left(UCase(StringField(os,9,",")),2)<>"LR"
            dvt()\o()\p1=Random(Val( Right(StringField(os,9,","), Len(StringField(os,9,","))-1 )))
          EndIf
          If Left(UCase(StringField(os,9,",")),1)="L" And Left(UCase(StringField(os,9,",")),2)<>"LR"
            dvt()\o()\p1=-Random(Val( Right(StringField(os,9,","), Len(StringField(os,9,","))-1 )))
          EndIf
          If Left(UCase(StringField(os,9,",")),2)="LR"
            kx= Val( Right(StringField(os,9,","), Len(StringField(os,9,","))-2 ))
            dvt()\o()\p1=Random(kx * 2)-kx
          EndIf
        EndIf
        dvt()\o()\x  * scale
        dvt()\o()\y  * scale
        dvt()\o()\w  * scale
        dvt()\o()\h  * scale
        If dvt()\o()\type= 4 Or dvt()\o()\type= 6
          dvt()\o()\fontSize * scale
        EndIf
        If dvt()\o()\type= 15
          kx= Val(StringField(dvt()\o()\txt,1,";")) * scale
          ky= Val(StringField(dvt()\o()\txt,2,";")) * scale
          dvt()\o()\txt= Str(kx)+";"+Str(ky)
        EndIf
      Else
        dvt()\o()\h  * scale
      EndIf
      
      If dvt()\o()\fontName And dvt()\o()\fontSize
        f= LoadFont(#PB_Any, dvt()\o()\fontName, dvt()\o()\fontSize, #PB_Font_HighQuality)
        If IsFont(f)
          dvt()\o()\font= f
        EndIf
      EndIf
    Next on
  Next tn
  

  
  ForEach dvt()
    img=CreateImage(#PB_Any,dvt()\width,dvt()\height,32)
    bum=CreateImage(#PB_Any,dvt()\width,dvt()\height,32)
    
    For mode= 0 To 1
      If mode
        StartVectorDrawing(ImageVectorOutput(bum))
      Else
        StartVectorDrawing(ImageVectorOutput(img))
      EndIf
      ForEach dvt()\o()
        With dvt()\o()
          ;comandos
          If \type= 100 ;LOOP
            loopN= \color
            x= \x: y= \y: w= \w: h= \h
          Else
            If loopN>1
              ox= \x: oy= \y: ow= \w: oh= \h
            EndIf
            ;objetos
            For n=1 To loopN
              If mode
                c= \level * 17
                ink= RGBA(c,c,c,255)
              Else
                ink= dvt()\o()\color
              EndIf
              
              If mode=0 Or (mode And \level>0)
              Select \type
                  ;{ BOX
                Case 0  ;BOX p2(=0 fill >0 stroke)
                  RotateCoordinates(\x+(\w/2),\y+(\h/2),\p1)
                  VectorSourceColor(ink)
                  AddPathBox(\x,\y,\w,\h)
                  If \p2:StrokePath(\p2) : Else: FillPath(): EndIf
                  RotateCoordinates(\x+(\w/2),\y+(\h/2),\p1 * -1)
                  ;}
                  ;{ ROUNDBOX
                Case 1  ;ROUNDBOX p1(px round corner) p2(=0 fill >0 stroke)
                  txt= "M "+Str(\x+\p1+\p1)+" "+Str(\y)+" L "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+
                       "C "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y+\p1+\p1)+" L "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+
                       "C "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+Str(\x+\w)+" "+Str(\y+\h)+" "+Str(\x+\w-(\p1+\p1))+" "+Str(\y+\h)+" L "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+
                       "C "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h-(\p1+\p1))+" L "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+
                       "C "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+Str(\x)+" "+Str(\y)+" "+Str(\x+\p1+\p1)+" "+Str(\y)+" "
                  VectorSourceColor(ink)
                  AddPathSegments(txt)
                  If \p2:StrokePath(\p2) : Else: FillPath(): EndIf
                  ;}
                  ;{ ELLIPSE
                Case 2  ;ELLIPSE p2(=0 fill >0 stroke)
                  VectorSourceColor(ink)
                  AddPathEllipse(\x,\y,\w,\h)
                  If \p2:StrokePath(\p2) : Else: FillPath(): EndIf
                  ;}
                  ;{ LINE
                Case 3  ;LINE
                  VectorSourceColor(ink): MovePathCursor(\x,\y): AddPathLine(\w,\h): StrokePath(\p2)
                  ;}
                  ;{ TEXT
                Case 4  ;TEXT p1(angle) p2(=0 fill >0 stroke)
                  RotateCoordinates(\x,\y,\p1)
                  VectorFont(FontID(\font))
                  VectorSourceColor(ink)
                  MovePathCursor(\x,\y)
                  AddPathText(\txt)
                  If \p2:StrokePath(\p2) : Else: FillPath(): EndIf
                  RotateCoordinates(\x,\y,\p1 * -1)
                  ;}
                  ;{ SHAPE
                Case 5  ;SHAPE p2(=0 fill >0 stroke)
                  VectorSourceColor(ink)
                  AddPathSegments(\txt)
                  If \p2:StrokePath(\p2) : Else: FillPath(): EndIf
                  ;}
                  ;{ TEXTBOX
                Case 6  ;TEXTBOX p1(angle)
                  RotateCoordinates(\x,\y,\p1)
                  VectorFont(FontID(\font))
                  VectorSourceColor(ink)
                  MovePathCursor(\x,\y)
                  DrawVectorParagraph(\txt,\w,\h)
                  RotateCoordinates(\x,\y,\p1 * -1)
                  ;}
                  ;{ BRIK
                Case 7  ;BRIK
                  If Not mode
                    \randSeed= Random(9999)
                  EndIf
                  RandomSeed(\randSeed)
                  VectorSourceColor($ff888888): FillVectorOutput();AddPathBox(0,0,dvt()\width,dvt()\height): FillPath()
                  bn=0: bx=0: by=0: bw=dvt()\width/\x: bh=dvt()\height/\y
                  sep= \w
                  While by < dvt()\height
                    If \p1: ang.f= Sin(bx+by)*2: RotateCoordinates(bx+(bw/2),by+(bh/2),ang): EndIf
                    VectorSourceColor(ink): AddPathBox(bx,by,bw-sep,bh-sep): FillPath()
                    If Not mode:VectorSourceColor(RGBA(0,0,0,Random(150))): AddPathBox(bx,by,bw-sep,bh-sep): StrokePath(4):EndIf ;border
                    rc=Random(255):oc=RGBA(rc,rc,rc,Random(50)):VectorSourceColor(oc): AddPathBox(bx,by,bw-sep,bh-sep): FillPath()
                    If \p1: RotateCoordinates(bx+(bw/2),by+(bh/2),ang * -1): EndIf
                    bx+bw
                    If bx>dvt()\width
                      by+bh: bn+1
                      If bn%2=0
                        bx=0
                      Else
                        bx=-(bw)/2
                      EndIf
                    EndIf
                  Wend
                  If \p2;noise
                    Select \p2
                      Case 1
                        noi= (dvt()\width * dvt()\height) /64
                        While noi>0
                          If Random(2)
                          VectorSourceColor(RGBA(0,0,0,Random(50))): AddPathCircle(Random(dvt()\width),Random(dvt()\height), Random(3,1)/4): FillPath()
                          VectorSourceColor(RGBA(255,255,255,Random(50))): AddPathCircle(Random(dvt()\width),Random(dvt()\height), Random(3,1)/4): FillPath()
                          EndIf
                          noi-1
                        Wend
                      Case 2
                        bx=0:by=0
                        While by<dvt()\height
                          bx+ Random(40,3):If bx > dvt()\width: bx=-5:by+Random(10,1):EndIf
                          If Random(1): VectorSourceColor($08000000): Else: VectorSourceColor($08ffffff) :EndIf
                          MovePathCursor(bx,by)
                          AddPathLine(bx+Random(40,3),by):StrokePath(1)
                        Wend
                    EndSelect
                  EndIf
                  ;}
                  ;{ WOOD
                Case 8  ;WOOD
                  SaveVectorState()
                  RotateCoordinates(\x+(\w/2),\y+(\h/2), \p1)
                  AddPathBox(\x,\y,\w,\h)
                  ClipPath()
                  If Not mode
                    VectorSourceColor(ink): FillVectorOutput();AddPathBox(0,0,dvt()\width,dvt()\height): FillPath()
                    bx= (dvt()\width*0.1)+ Random(dvt()\width-(dvt()\width*0.2))
                    by= (dvt()\height*0.1)+ Random(dvt()\height-(dvt()\height*0.2)): noi= dvt()\width
                    While noi > 10
                      VectorSourceColor(ink)
                      AddPathEllipse(bx,by,noi,noi):FillPath()
                      If Random(1)
                        VectorSourceColor(RGBA(0,0,0,Random(40)))
                      Else
                        VectorSourceColor(RGBA(255,255,255,Random(40)))
                      EndIf
                      AddPathEllipse(bx,by,noi,noi):FillPath()
                      noi- Random(20,5)
                    Wend
                    If Random(1)
                      VectorSourceColor(RGBA(0,0,0,Random(15)))
                    Else
                      VectorSourceColor(RGBA(255,255,255,Random(15)))
                    EndIf
                    AddPathBox(\x,\y,\w,\h): FillPath()
                  Else
                    c= \level * 17
                    ink= RGBA(c,c,c,255)
                    VectorSourceColor(ink)
                    AddPathBox(\x,\y,\w,\h)
                    FillPath()
                  EndIf
                  RestoreVectorState()
                  ;}
                  
                  ; -------- OVERLAY FX
                  ;{ SPLASH
                Case 9 ; SPLASH
                  If Not mode
                    \randSeed= Random(9999)
                    If \p1:\x=Random(dvt()\width):EndIf
                    If \p1:\y=Random(dvt()\height):EndIf
                    If \p2:\w=Random(dvt()\width,dvt()\width*0.2):EndIf
                    If \p2:\h=Random(dvt()\height,dvt()\height*0.2):EndIf
                  EndIf
                  RandomSeed(\randSeed)
                  For p= 1 To 5
                    bx= \x+(\w/2)
                    by= \y+(\h/2)
                    bw= \w * 0.2
                    bh= Random(360)
                    sep= bw
                    While bw>1
                      If Random(1)
                        VectorSourceColor(ink)
                        AddPathCircle(bx,by,bw)
                        FillPath()
                        If Random(1)
                        If Not mode And bw>5
                        VectorSourceColor($11000000)
                        AddPathCircle(bx,by,bw-3)
                        FillPath()
                        VectorSourceColor(ink)
                        AddPathCircle(bx-2,by+2,bw-3)
                        FillPath()
                        EndIf
                        EndIf
                      EndIf
                      bx= (\x+(\w/2)) + Cos(Radian(bh)) * sep
                      by= (\y+(\h/2)) + Sin(Radian(bh)) * sep
                      bw - Random(8)
                      sep+ Random(15)
                    Wend
                  Next p
                  ;}
                  ;{ DIRTY
                Case 10 ; DIRTY
                  If Not mode
                    If \p1=0:\p1=10:EndIf
                    For noi= 1 To \p1
                      bx= Random(dvt()\width)
                      by= Random(dvt()\height)
                      bw= Random(dvt()\width/2,dvt()\width/6)
                      VectorSourceCircularGradient(bx, by, bw);, -50, -50)
                      VectorSourceGradientColor(\color, 0.0)
                      VectorSourceGradientColor(RGBA(Red(\color),Green(\color),Blue(\color),0), 1.0)
                      FillVectorOutput()
                    Next noi
                  EndIf
                  ;}
                  ;{ DIRTYPOINT
                Case 11 ; DIRTYPOINT
                    VectorSourceCircularGradient(\x,\y,\w);, -50, -50)
                    VectorSourceGradientColor(ink, 0.0)
                    VectorSourceGradientColor(RGBA(Red(ink),Green(ink),Blue(ink),0), 1.0)
                    FillVectorOutput()
                  ;}
                  ;{ RAYS
                Case 12 ; RAYS
                  If Not mode
                    \randSeed= Random(9999)
                  EndIf
                  RandomSeed(\randSeed)
                  bx= Random(dvt()\width)
                  by= Random(dvt()\height)
                  bh= Random(360)
                  VectorSourceColor(ink)
                  For noi= 1 To 15
;                     RandomSeed(\randSeed+noi)
                    bw= Random(dvt()\width*0.075,dvt()\width*0.025) ;radio
                    nx= bx + (Cos(Radian(bh)) * bw)
                    ny= by + (Sin(Radian(bh)) * bw)
                    MovePathCursor(bx,by): AddPathLine(nx,ny):StrokePath(\p1)
                    bx=nx: by=ny
                    bh+ Random(60)-30
                    If Random(2)
                      nw=bx:nh=by
                      na=bh
                      rc= Random(10,1)
                      For k=1 To rc
                        na+ Random(90)-45
                        bw= Random(dvt()\width*0.1,dvt()\width*0.025) ;radio
                        nx= nw + (Cos(Radian(na)) * bw)
                        ny= nh + (Sin(Radian(na)) * bw)
                        MovePathCursor(nw,nh): AddPathLine(nx,ny):StrokePath(\p1)
                        nw=nx:nh=ny
                      Next k
                    EndIf
                  Next noi
                  ;}
                  ;{ LEAFS
                Case 13 ; LEAFS
                  If Not mode
                    \randSeed= Random(9999)
;                   Else
;                     ink= $88ffffff
                  EndIf
                  RandomSeed(\randSeed)
                  bx= Random(dvt()\width)
                  by= Random(dvt()\height)
                  bh= Random(360)
                  For noi= 1 To 15
                    bw= Random(dvt()\width*0.075,dvt()\width*0.025) ;radio
                    nx= bx + (Cos(Radian(bh)) * bw)
                    ny= by + (Sin(Radian(bh)) * bw)
                  VectorSourceColor(ink)
                    MovePathCursor(bx,by): AddPathLine(nx,ny):StrokePath(\p1)
                    bx=nx: by=ny
                    bh+ Random(60)-30
                    If Random(2)
                      nw=bx:nh=by
                      na=bh
                      rc= Random(10,1)
                      For k=1 To rc
                        na+ Random(90)-45
                        bw= Random(dvt()\width*0.1,dvt()\width*0.025) ;radio
                        nx= nw + (Cos(Radian(na)) * bw)
                        ny= nh + (Sin(Radian(na)) * bw)
                  VectorSourceColor(ink)
                        MovePathCursor(nw,nh): AddPathLine(nx,ny):StrokePath(\p1)
                        ;hoja
                        c= Random(40)-20
                        nx= nw + (Cos(Radian(na+c)) * bw/4)
                        ny= nh + (Sin(Radian(na+c)) * bw/4)
                  VectorSourceColor(ink)
                        MovePathCursor(nw,nh): AddPathLine(nx,ny):StrokePath(\p1*2,#PB_Path_RoundEnd)
                          If Random(1)
                            VectorSourceColor(RGBA(0,0,0,Random(50,10)))
                          Else
                            VectorSourceColor(RGBA(255,255,255,Random(50,10)))
                          EndIf
                          MovePathCursor(nw,nh): AddPathLine(nx,ny):StrokePath(\p1*2,#PB_Path_RoundEnd)
                        nw=nx:nh=ny
                      Next k
                    EndIf
                  Next noi
                  ;}
                  ;{ NOISE
                Case 14 ; NOISE
                  If \w=0:\w=512:EndIf
                  If \h=0:\h=512:EndIf
                  SaveVectorState()
                  AddPathBox(\x,\y,\w,\h)
                  ClipPath()
                  bx=0:by=0
                  While by < dvt()\height
                    Select Random(2)
                      Case 0
                        VectorSourceColor(RGBA(255,255,255,Random(50,10)))
                      Case 1
                        VectorSourceColor(RGBA(0,0,0,Random(50,10)))
                      Case 2
                        VectorSourceColor(RGBA(Red(ink),Green(ink),Blue(ink),Random(50,10)))
                    EndSelect
                    If Random(1)
                      AddPathCircle(bx,by,Random(4,1)*0.5):FillPath()
                    EndIf
                    bx+Random(3):If bx > dvt()\width: by+Random(4,1): bx=0:EndIf
                  Wend
                  RestoreVectorState()
                  ;}
                  ;{ RADIALBOX
                  Case 15 ; RADIALBOX,384,224,64,32,"x;y",$ff0000ff,15,,10,20|"+
                    ang=0
                    bx= Val(StringField(\txt,1,";"))
                    by= Val(StringField(\txt,2,";"))
                    VectorSourceColor(ink)
                    AddPathBox(\x,\y,\w,\h)
                    FillPath()
                    For c= 0 To \p1
                      RotateCoordinates(bx,by,\p2)
                      AddPathBox(\x,\y,\w,\h)
                      FillPath()
                    Next c
;                     RotateCoordinates(bx,by,0)
                    ResetCoordinates()
                  ;}
                  ;{ RADIALROUNDBOX
                  Case 18 ; "RADIALROUNDBOX,16,240,64,32,$ff997755,15,256;256,8,20|"+  posición inicial x,y,w,h,color,nivel,centerx;centery,p1=pasos,p2=grados añadidos
                    ang=0
                    bx= Val(StringField(\txt,1,";"))
                    by= Val(StringField(\txt,2,";"))
                    noi= \p1
                    \p1=5
                    txt= "M "+Str(\x+\p1+\p1)+" "+Str(\y)+" L "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+
                         "C "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y+\p1+\p1)+" L "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+
                         "C "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+Str(\x+\w)+" "+Str(\y+\h)+" "+Str(\x+\w-(\p1+\p1))+" "+Str(\y+\h)+" L "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+
                         "C "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h-(\p1+\p1))+" L "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+
                         "C "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+Str(\x)+" "+Str(\y)+" "+Str(\x+\p1+\p1)+" "+Str(\y)+" "
                    VectorSourceColor(ink)
                    AddPathSegments(txt)
                    FillPath()
                    For c= 0 To noi
                      RotateCoordinates(bx,by,\p2)
;                       AddPathBox(\x,\y,\w,\h)
                      AddPathSegments(txt)
                      FillPath()
                    Next c
;                     RotateCoordinates(bx,by,0)
                    ResetCoordinates()
                    \p1=noi
                  ;}
                  ;{ GLASS
                  Case 16 ;GLASS
                    VectorSourceColor(ink)
                    AddPathBox(\x,\y,\w,\h):FillPath()
                    SaveVectorState()
                    AddPathBox(\x,\y,\w,\h)
                    ClipPath()
                    For noi= 0 To 5
                      bx= \x+Random(\w)
                      by= \y+Random(\h)
                      bw= Random(360)
                      RotateCoordinates(bx,by,bw)
                      txt= "M "+Str(bx-Random(\w*0.4,\w*0.2))+" "+Str(by-Random(\h*0.4,\h*0.2))+" "+
                           "L "+Str(bx+Random(\w*0.4,\w*0.2))+" "+Str(by-Random(\h*0.4,\h*0.2))+" "+
                           "L "+Str(bx+Random(\w*0.4,\w*0.2))+" "+Str(by+Random(\h*0.4,\h*0.2))+" "+
                           "L "+Str(bx+Random(\w*0.4,\w*0.2))+" "+Str(by-Random(\h*0.4,\h*0.2))+" "+
                           "L "+Str(bx+Random(\w*0.4,\w*0.2))+" "+Str(by+Random(\h*0.4,\h*0.2))+" "+
                           "L "+Str(bx-Random(\w*0.4,\w*0.2))+" "+Str(by+Random(\h*0.4,\h*0.2))+" Z"
                      If noi= 0
                        VectorSourceColor($ff000000): AddPathSegments(txt): FillPath()
                      Else
                        If mode     
                          VectorSourceColor(RGBA(100+noi*5,100+noi*5,100+noi*5,255)): AddPathSegments(txt): FillPath()
                        Else
                          VectorSourceColor(ink): AddPathSegments(txt): FillPath()
                        EndIf
                        If Random(1)
                          VectorSourceColor(RGBA(0,0,0,Random(50,10))): AddPathSegments(txt): FillPath()
                        Else
                          VectorSourceColor(RGBA(255,255,255,Random(50,10))): AddPathSegments(txt): FillPath()
                        EndIf
                      EndIf
                      RotateCoordinates(bx,by,bw * -1)
                    Next noi
                    RestoreVectorState()
                  ;}
                  ;{ STONE
                  Case 17 ;STONE
                    VectorSourceColor(ink)
;                     AddPathBox(0,0,VectorOutputWidth(),VectorOutputWidth())
                    FillVectorOutput()
                    bx= \x
                    by= \y
                    bw= \w
                    bh= \h
                    \w-2
                    \h-2
                    \p1= 5
                    \x= 0:\y=0
                    noi=1
                    While \y < dvt()\height
                      VectorSourceColor(ink)
                      txt= "M "+Str(\x+\p1+\p1)+" "+Str(\y)+" L "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+
                           "C "+Str(\x+\w-(\p1+\p1))+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y)+" "+Str(\x+\w)+" "+Str(\y+\p1+\p1)+" L "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+
                           "C "+Str(\x+\w)+" "+Str(\y+\h-(\p1+\p1))+" "+Str(\x+\w)+" "+Str(\y+\h)+" "+Str(\x+\w-(\p1+\p1))+" "+Str(\y+\h)+" L "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+
                           "C "+Str(\x+\p1+\p1)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h)+" "+Str(\x)+" "+Str(\y+\h-(\p1+\p1))+" L "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+
                           "C "+Str(\x)+" "+Str(\y+\p1+\p1)+" "+Str(\x)+" "+Str(\y)+" "+Str(\x+\p1+\p1)+" "+Str(\y)+" "
                      AddPathSegments(txt)
;                       FillPath()
                      FillPath(#PB_Path_Preserve)
                      Select Random(2)
                        Case 0
                          If Random(1)
                            VectorSourceColor($11000000)
                          Else
                            VectorSourceColor($11ffffff)
                          EndIf
                        Case 1
                          VectorSourceColor($22000000)
                        Case 2
                          VectorSourceColor($22ffffff)
                      EndSelect
;                       AddPathSegments(txt)
                      FillPath()
                      
                      If mode
                        SaveVectorState()
                        AddPathSegments(txt)
                        ClipPath()
                        VectorSourceCircularGradient(\x+(\w/2),\y+(\h/2),\w)
                        VectorSourceGradientColor($88ffffff,0)
                        VectorSourceGradientColor($88ffffff,0.5)
                        VectorSourceGradientColor($00ffffff,1)
                        FillVectorOutput()
                        RestoreVectorState()
                      EndIf
                      
                      \x+ bw
                      If \x > dvt()\width
                        \y+ bh;Random(\h,\h*0.1)
                        If noi % 2=0:\x= 0:Else: \x=-bw/2:EndIf
                      EndIf
                      noi+1
                    Wend
                    \x=bx:\y=by:\w=bw:\h=bh
                  ;}
              EndSelect
              EndIf
              \x+x:\y+y:\w+w:\h+h
            Next n
            If loopN>1
              loopN= 1: x=0: y=0: w=0: h=0
              \x=ox: \y=oy: \w=ow: \h=oh
            EndIf
          EndIf
        EndWith
      Next
      StopVectorDrawing()
      
      ;{ crea texturas
      If mode= 0
        ;textura
        dvt()\texture= CreateTexture(#PB_Any,ImageWidth(img),ImageHeight(img))
        StartDrawing(TextureOutput(dvt()\texture))
        DrawImage(ImageID(img),0,0)
        StopDrawing()
;         showImage(img)
        If freeimg
          FreeImage(img)
        Else
          dvt()\imgTexture= img
        EndIf
      Else
        
        ;bump
        nor= ImgToNormalMap(bum,dvt()\bumpForce,1,1)
;         showImage(bum)
        If freeimg
          FreeImage(bum)
        Else
          dvt()\imgBump= nor
        EndIf
        bum= nor
        dvt()\normal= CreateTexture(#PB_Any,ImageWidth(bum),ImageHeight(bum))
        StartDrawing(TextureOutput(dvt()\normal))
          DrawImage(ImageID(bum),-1,-1,OutputWidth()+2,OutputHeight()+2)
        StopDrawing()
;         showImage(bum)  
        FreeImage(bum)
      EndIf
      ;}
    Next mode
  Next
  
  ForEach dvt()
    ForEach dvt()\o()
      If IsFont(dvt()\o()\font): FreeFont( dvt()\o()\font ): EndIf
    Next
  Next
  
;   ClearList(dvt())
EndProcedure

;{ DVT draw vector texture INFO
; Syntax:
; HEAD:
;   texturename$,width,height,bumpforce (default=1)
; OBJECTS:
;   type$,x,y,w,h,color,level,txt$,p1,p2,fontname$,fontsize|#
;   --------------------------------------------------------------------
;   |= separate items to draw, #= separate textures
;   level param is how deeping is the elevation 0=bottom to 15 on the top
; OBJECTS TYPES:
;   BOX,ROUNDBOX,ELLIPSE,LINE,TEXT,SHAPE,TEXTBOX,BRIK,WOOD,SPLASH,DIRTY,DIRTYPOINT,RAYS,LEAFS,NOISE,RADIALBOX,GLASS,STONE
; Info about extra params
;   LOOP: x,y,w,h,nLoops nLopps=R10 random(10) (x,y,w,h added by cycle, can be negative and float number)
;   BOX,ROUNDBOX,ELLIPSE,TEXT,SHAPE: p1=angle p2>0 stroke, 0=fillpath (p1 R=random right, L=random left, LR=random)
;   LINE,x1,y1,x2,y2,color,level,_,_,stroke
;   TEXT,TEXTBOX: p1= angle
;   BRIK: p1=1 brik random angle, p2=1 noise - (full paint texture)
;   SPLASH,x,y,w,h,color,level,_,randomXY,randomWH
;   WOOD: color
;   LEAFS,0,0,0,0,$ff445588,7,,1=ancho linea
;   RADIALBOX,364,240,54,32,$ffbbbbbb,15,256;256,17,20 text="Xcenter;Ycenter"
;   STONE,0,0,64,32,$ff997755,3  - _,_,brikW,brikH,color,deep
;}

CompilerIf #PB_Compiler_IsMainFile
;{ start 3D
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0,0, 1200,700, "DVT draw vector texture bump [Space next texture]",#PB_Window_ScreenCentered)
; AntialiasingMode(#PB_AntialiasingMode_x6)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0),WindowHeight(0), 0, 0, 0)
  CompilerIf #PB_Compiler_Version >= 620 ;this is for new PB. Thanks miso :)
    Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Main", #PB_3DArchive_FileSystem)
    Parse3DScripts() 
  CompilerElse
;     Parse3DScripts() 
  CompilerEndIf
; WorldShadowsEx(1000,1024,3,0.00002)
WorldShadows(#PB_Shadow_Modulative,1000,RGB(128,128,128),2048)

; light = CreateLight(#PB_Any ,$ffffff, 15, 10, -20, #PB_Light_Point)
CreateLight(0 ,$ffffff, 0, 20, 0,#PB_Light_Directional):LightDirection(0 ,-1,-0.9,0.75)
AmbientColor($aaaaaa)
; AmbientColor($888888)

CreateCamera(0,0,0,100,100):MoveCamera(0,3,2.5,0,#PB_Absolute):CameraLookAt(0,0,1.2,0)
MoveCamera(0,0,0,1,#PB_Relative)
;}

;{ TEXTURAS VECTORIALES
f.s=  ""

f+    "adoquines,512,512,1|"+
      "STONE,0,0,64,32,$ff997755,1|"+
      "TEXT,20,20,0,0,$ffffffff,-1,Press space,0,0,Impact,70|"+
      "TEXT,20,120,0,0,$ffffffff,-1,PureBasic,0,0,Impact,70|"+
      "#"

f+    "adoquines,512,512,1|"+
      "STONE,0,0,64,32,$ff997755,1|"+
      "NOISE,0,0,512,512,$11000000,-1|"+
      "DIRTY,0,0,0,0,$55334455|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "LOOP,0,0,0,0,5|"+
      "LEAFS,0,0,0,0,$ff778899,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "muro gris,512,512,1|"+
      "BRIK,8,16,6,0,$ff888888,8,,1,2|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff888888,13|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff888888,13|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "LOOP,0,0,0,0,5|"+
      "LEAFS,0,0,0,0,$ff778899,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"


;}

dvtData(f,0)


mesh_plano= CreatePlane(#PB_Any,100,100,1,1,1,1)
mate_plano= CreateMaterial(#PB_Any,#Null,$888888)
enti_plano= CreateEntity(#PB_Any,MeshID(mesh_plano),MaterialID(mate_plano))

texturas= ListSize(dvt())
Dim mates(texturas)
mesh= CreateCube(#PB_Any,1)
n=0
ForEach dvt()
  mates(n)=  CreateShaderMaterial(#PB_Any, #PB_Material_BumpShader)
  MaterialShaderTexture(mates(n),TextureID(dvt()\texture),TextureID(dvt()\normal),0,0)
  MaterialShaderParameter(mates(n),#PB_Shader_Fragment,"bumpy",#PB_Shader_Float,2,0,0,0)
  SetMaterialColor(mates(n), #PB_Material_DiffuseColor,RGB(250,250,250))
  SetMaterialColor(mates(n), #PB_Material_AmbientColor,RGB(160,160,160))
  MaterialShininess(mates(n),125,$ffffff)
  MaterialFilteringMode(mates(n),#PB_Material_Trilinear)
;   MaterialFilteringMode(mates(n),#PB_Material_Anisotropic,8)
  n+1
Next
; ClearList(dvt())

SelectElement(dvt(),0)
enti= CreateEntity(#PB_Any,MeshID(mesh),MaterialID(mates(0)),0,1.2,0)
w.f= TextureWidth(dvt()\texture) / 512
h.f= TextureHeight(dvt()\texture) / 512
ScaleEntity(enti,w,h,1,#PB_Absolute)

CreateLine3D(#PB_Any, -20,0,0,$0000ff, 20,0,0,$00ffff)
CreateLine3D(#PB_Any, 0,0,-20,$ff0000, 0,0,20,$ffff00)

sy.f=1

Procedure CameraUserControl(camera,speed.f=0.1,smooth.f=0.1,yfixed.f=1e10)
  Static.f MouseX,Mousey,depx,depz,sdepx,sdepz,     fdf.b
  
  depx=-speed*(KeyboardPushed(#PB_Key_Left)-KeyboardPushed(#PB_Key_Right))
  depz=-speed*(KeyboardPushed(#PB_Key_Down)-KeyboardPushed(#PB_Key_Up)-MouseWheel()*20)
  If KeyboardReleased(#PB_Key_F12):fdf=1-fdf:If fdf:CameraRenderMode(0,#PB_Camera_Wireframe):Else:CameraRenderMode(0,#PB_Camera_Textured):EndIf:EndIf
  MouseX = -MouseDeltaX() *  0.05
  MouseY = -MouseDeltaY() *  0.05
  RotateCamera(camera, MouseY, MouseX, 0, #PB_Relative)
  sdepx+(depx-sdepx)*smooth
  sdepz+(depz-sdepz)*smooth
  MoveCamera  (camera, sdepX, 0, -sdepz)
  If yfixed<>1e10:MoveCamera(camera,CameraX(camera),yfixed,CameraZ(camera),#PB_Absolute):EndIf
EndProcedure


; ReleaseMouse(#True)

Repeat
  While WindowEvent():Wend
  ExamineMouse(): ExamineKeyboard()
  
  If KeyboardReleased(#PB_Key_1)
    sy-0.1:If sy<0.1:sy=0.1:EndIf
    ScaleEntity(enti,1,sy,1,#PB_Absolute)
  ElseIf KeyboardReleased(#PB_Key_2)
    sy+0.1
    ScaleEntity(enti,1,sy,1,#PB_Absolute)
  EndIf
  
  CameraUserControl(0, 0.001)
  
  If KeyboardReleased(#PB_Key_Space)
    p+1:If p>=texturas:p=0:EndIf
    SelectElement(dvt(), p)
    Debug Str(ListIndex(dvt()))+"    "+dvt()\name
    w.f= TextureWidth(dvt()\texture) / 512
    h.f= TextureHeight(dvt()\texture) / 512
    ScaleEntity(enti,w,h,1,#PB_Absolute)
    SetEntityMaterial(enti,MaterialID(mates(p)))
  EndIf
  
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
End

CompilerEndIf
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
minimy
Enthusiast
Enthusiast
Posts: 551
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Vectorial texture and normal map creator

Post by minimy »

And here more examples textures:

Sorry about any things are in spanish :mrgreen:

Code: Select all

f+    "Muro verde ventana,512,512,1|"+
      "BRIK,8,16,6,0,$ff448822,8,,1,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff888888,13|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff888888,13|"+
      "LOOP,0,128,0,0,2|"+
      "BOX,128,130,256,61,$ff999999,13|"+
      "BOX,148,194,216,61,$ff999999,13|"+
      "BOX,0,448,512,64,$ff888888,15|"+
      "WOOD,168,144,178,160,$ff665544,5|"+
      "BOX,159,145,196,24,$ff999999,15|"+
      "LOOP,0,10,0,0,R10|"+
      "BOX,169,169,176,9,$ff554433,13|"+
      "NOISE,0,0,512,512,$77000000,-1|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "DIRTYPOINT,0,0,256,256,$88228844|"+
      "DIRTYPOINT,512,0,256,256,$88228844|"+
      "DIRTYPOINT,0,512,256,256,$88228844|"+
      "DIRTYPOINT,512,512,256,256,$88228844|"+
      "LOOP,0,0,0,0,15|"+
      "LEAFS,0,0,0,0,$ff11aa33,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

; f.s=  ""
f+    "Muro verde,512,512,1|"+
      "BRIK,8,16,6,0,$ff448822,8,,1,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff888888,13|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff888888,13|"+
      "NOISE,0,0,512,512,$77000000,-1|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "DIRTYPOINT,0,0,256,256,$88228844|"+
      "DIRTYPOINT,512,0,256,256,$88228844|"+
      "DIRTYPOINT,0,512,256,256,$88228844|"+
      "DIRTYPOINT,512,512,256,256,$88228844|"+
      "LOOP,0,0,0,0,15|"+
      "LEAFS,0,0,0,0,$ff11aa33,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "Muro verde puerta,512,512,1|"+
      "BRIK,8,16,6,0,$ff448822,8,,1,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff888888,13|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff999999,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff888888,13|"+
      "NOISE,0,0,512,512,$77000000,-1|"+
      "WOOD,148,144,212,400,$ff112233,0|"+
      "LOOP,32,0,0,0,6|"+
      "WOOD,158,154,31,490,$ff224466,6|"+
      "WOOD,240,186,32,300,$ff334455,10,,30|"+
      "WOOD,158,186,192,32,$ff334455,10|"+
      "WOOD,158,448,192,32,$ff334455,10|"+
      "ELLIPSE,173,204,5,5,$ff999999,15|"+
      "ELLIPSE,333,204,5,5,$ff999999,15|"+
      "ELLIPSE,173,464,5,5,$ff999999,15|"+
      "ELLIPSE,333,464,5,5,$ff999999,15|"+
      "BOX,168,310,40,50,$ff444444,13|"+
      "BOX,178,330,40,10,$ff444444,15,,30|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "DIRTYPOINT,0,0,256,256,$88228844|"+
      "DIRTYPOINT,512,0,256,256,$88228844|"+
      "DIRTYPOINT,0,512,256,256,$88228844|"+
      "DIRTYPOINT,512,512,256,256,$88228844|"+
      "LOOP,0,0,0,0,15|"+
      "LEAFS,0,0,0,0,$ff11aa33,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "BAJO1,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "BOX,0,0,512,62,$ff8899aa,14|"+
      "BOX,0,0,32,512,$ff8899aa,14|"+
      "BOX,480,0,32,512,$ff8899aa,14|"+
      "LOOP,0,64,0,0,8|"+
      "BOX,0,16,16,30,$ff8899aa,10|"+
      "LOOP,0,64,0,0,8|"+
      "BOX,496,16,16,30,$ff8899aa,10|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "BLUE BILLBOARD,512,405,1|"+
      "BOX,0,0,512,512,$ff000000,8|"+
      "LOOP,0,50,0,0,8|"+
      "ROUNDBOX,0,5,512,45,$ffff0000,12,,5|"+
      "ROUNDBOX,3,3,506,399,$ffffffff,8,,5,6|"+
      "TEXT,20,20,0,0,$ffffffff,-1,DOWN TOWN,0,0,Impact,70|"+
      "BOX,236,130,40,100,$ffffffff,-1|"+
      "TEXT,140,150,0,0,$ffffffff,-1,▼,0,0,Impact,170|"+
      "DIRTY,0,0,0,0,$88223344|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "PISO1b,512,512,1|"+
      "BOX,0,0,512,512,$ff333333,8|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "BOX,76,101,360,200,$ff445566,10|"+
      "GLASS,86,111,340,180,$ff443322,2|"+
      "BOX,76,202,360,8,$ff445566,10|"+
      "BOX,252,108,8,190,$ff445566,10|"+
      "BOX,252,108,8,190,$ff443322,5|"+
      "LOOP,0,10,0,0,R15|"+
      "BOX,76,101,360,9,$ff8899aa,6|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "PISO1b,512,512,1|"+
      "BOX,0,0,512,512,$ff333333,8|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "BOX,76,101,360,200,$ff445566,10|"+
      "GLASS,86,111,340,180,$ff443322,2|"+
      "BOX,76,202,360,8,$ff445566,10|"+
      "BOX,252,108,8,190,$ff445566,10|"+
      "BOX,252,108,8,190,$ff443322,5|"+
      "LOOP,0,10,0,0,R15|"+
      "BOX,76,101,360,9,$ff8899aa,6|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "PISO1a,512,512,1|"+
      "BOX,0,0,512,512,$ff333333,8|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "LINE,0,456,512,456,$ff111111,13,,,3|"+
      "LINE,0,460,512,460,$ff111111,12,,,3|"+
      "LINE,0,464,512,460,$ff888888,13,,,3|"+
      "BOX,30,450,40,40,$ff888888,14,,R20|"+
      "BOX,80,440,50,60,$ff998877,14,,LR20|"+
      "LOOP,100,0,0,0,4|"+
      "BOX,56,82,98,20,$ff556677,14|"+
      "BOX,400,10,90,70,$ff999999,15,,1|"+
      "LOOP,0,8,0,0,8|"+
      "BOX,405,15,80,5,$ff555555,2|"+
      "BOX,76,101,360,200,$ff443322,5|"+
      "GLASS,86,111,340,180,$ff443322,2|"+
      "BOX,76,202,360,8,$ff443322,5|"+
      "BOX,252,108,8,190,$ff443322,5|"+
      "LOOP,0,10,0,0,R15|"+
      "BOX,76,101,360,8,$ff8899aa,6|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "LOOP,0,0,0,0,10|"+
      "LEAFS,0,0,0,0,$ff667788,13,,1|"+
      "#"

f+    "GARAGE ZOMBIE,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "BOX,50,50,412,472,$ff333333,2|"+
      "LOOP,0,20,0,0,21|"+
      "BOX,55,90,402,19,$ffbbbbbb,3|"+
      "NOISE,50,50,412,472,$ff335566,-1|"+
      "BOX,50,50,412,40,$ffcccccc,9|"+
      "NOISE,50,50,412,472,$ff335566,-1|"+
      "TEXT,104,144,0,0,$990000ff,-1,UNDEAD,20,0,Comic Sans MS,70|"+
      "TEXT,100,340,0,0,$99ffffff,-1,ZONE,-20,0,Comic Sans MS,70|"+
      "LOOP,0,0,0,0,5|"+
      "SPLASH,-1,-1,150,150,$77000066,-1,,1|"+
      "LOOP,0,0,0,0,5|"+
      "SPLASH,-1,-1,100,100,$ff000055,-1,,1|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "DIRTY,0,0,512,512,$33223344|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "#"

f+    "SECURITY BOX,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "BOX,50,50,412,412,$ffbbbbbb,3|"+
      "ELLIPSE,90,90,20,20,$ff0000ff,1|"+
      "ELLIPSE,256,256,180,180,$ffbbbbbb,9|"+
      "ELLIPSE,256,256,170,170,$ffbbbbbb,10|"+
      "ELLIPSE,256,256,100,100,$ffbbbbbb,3|"+
      "ELLIPSE,256,256,80,80,$ffaaaaaa,2|"+
      "BOX,190,255,132,2,$ffbbbbbb,12,,20|"+
      "ELLIPSE,256,256,40,40,$ffbbbbbb,13|"+
      "ELLIPSE,256,256,20,20,$ffcccccc,15|"+
      "RADIALBOX,364,240,54,32,$ffbbbbbb,15,256;256,17,20|"+
      "BOX,390,60,60,60,$ff00ffff,-1|"+
      "TEXTBOX,395,65,50,50,$ff000000,-1,CAUTION DONT KEEP OPEN,0,0,ARIAL,8|"+
      "DIRTY,0,0,512,512,$33335577,,20|"+
      "DIRTY,0,0,512,512,$66337755|"+
      "DIRTYPOINT,256,256,200,0,$66000000,-1|"+
      "#"

f+    "ROAD,512,512,0.015|"+
      "BOX,0,0,512,512,$ff333333,8|"+
      "NOISE,0,0,0,0,$ff335566,1|"+
      "BOX,16,0,16,512,$aa00ffff,9|"+
      "BOX,480,0,16,512,$aa00ffff,9|"+
      "NOISE,0,0,0,0,$ff335566,-1|"+
      "TEXT,128,32,0,0,$aaffffff,-1,STOP,0,0,Impact,90|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "DIRTY,0,0,512,512,$33223344|"+
      "LEAFS,0,0,0,0,$ff009900,10,,1|"+
      "LEAFS,0,0,0,0,$ff00aa00,11,,1|"+
      "LEAFS,0,0,0,0,$ff00bb00,12,,1|"+
      "#"

f+    "DOOR ARC,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "ELLIPSE,256,178,120,120,$ff000000,1|"+
      "BOX,106,178,300,400,$ff000000,1|"+
      "WOOD,128,72,63,440,$ff445566,4|"+
      "WOOD,256,72,63,420,$ff445566,2|"+
      "WOOD,192,72,63,440,$ff445566,3|"+
      "WOOD,320,72,63,440,$ff445566,4|"+
      "WOOD,224,72,63,220,$ff445566,5,,-85|"+
      "WOOD,224,272,63,220,$ff445566,5,,-95|"+
      "NOISE|"+
      "RADIALBOX,96,156,54,44,$ff556677,14,256;178,33,5|"+
      "RADIALBOX,96,166,54,24,$ffbbbbbb,15,256;178,8,20|"+
      "BOX,96,190,54,320,$ff556677,14|"+
      "BOX,362,190,54,320,$ff556677,14|"+
      "LOOP,0,44,0,0,10|"+
      "BOX,96,210,54,24,$ffbbbbbb,15|"+
      "LOOP,0,44,0,0,10|"+
      "BOX,362,210,54,24,$ffbbbbbb,15|"+
      "LEAFS,0,0,0,0,$ff445588,7,,1|"+
      "LEAFS,0,0,0,0,$ff556677,8,,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LEAFS,0,0,0,0,$ff00aa00,12,,6|"+
      "LEAFS,0,0,0,0,$ff00bb00,13,,6|"+
      "LEAFS,0,0,0,0,$ff00cc00,14,,6|"+
      "DIRTYPOINT,0,512,260,0,$66005500,-1|"+
      "DIRTYPOINT,512,512,260,0,$66005500,-1|"+
      "#"

f+    "WINDOW ARC,512,512,1|"+
      "BOX,0,0,512,512,$ffbbbbbb,3|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "ELLIPSE,256,178,120,120,$ff000000,1|"+
      "WOOD,128,72,63,220,$ff445566,4|"+
      "WOOD,256,72,63,220,$ff445566,2|"+
      "WOOD,192,72,63,240,$ff445566,3|"+
      "WOOD,320,72,63,240,$ff445566,4|"+
      "WOOD,224,72,63,220,$ff445566,5,,85|"+
      "NOISE|"+
      "RADIALBOX,96,156,54,44,$ff556677,14,256;178,68,5|"+
      "RADIALBOX,96,166,54,24,$ffbbbbbb,15,256;178,17,20|"+
      "LEAFS,0,0,0,0,$ff445588,7,,1|"+
      "LEAFS,0,0,0,0,$ff556677,8,,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LEAFS,0,0,0,0,$ff00aa00,12,,6|"+
      "LEAFS,0,0,0,0,$ff00bb00,13,,6|"+
      "LEAFS,0,0,0,0,$ff00cc00,14,,6|"+
      "DIRTYPOINT,0,512,260,0,$66005500,-1|"+
      "DIRTYPOINT,512,512,260,0,$66005500,-1|"+
      "#"

f+    "WALLGREEN,512,512,1|"+
      "BOX,0,0,512,512,$ffbbbbbb,3|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "LEAFS,0,0,0,0,$ff445588,7,,1|"+
      "LEAFS,0,0,0,0,$ff556677,8,,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LEAFS,0,0,0,0,$ff00aa00,12,,6|"+
      "LEAFS,0,0,0,0,$ff00bb00,13,,6|"+
      "LEAFS,0,0,0,0,$ff00cc00,14,,6|"+
      "DIRTYPOINT,0,512,260,0,$66005500,-1|"+
      "DIRTYPOINT,512,512,260,0,$66005500,-1|"+
      "#"

f+    "PANEL,512,512,1|"+
      "BOX,0,0,511,511,$ffffffff,0|"+
      "ROUNDBOX,10,10,492,492,$ffbb3300,2|"+
      "ROUNDBOX,70,70,371,371,$ffbb3322,5|"+
      "ELLIPSE,40,40,15,15,$ffaaaaaa,12|"+
      "ELLIPSE,472,40,15,15,$ffaaaaaa,11|"+
      "ELLIPSE,472,472,15,15,$ffaaaaaa,13|"+
      "ELLIPSE,40,472,15,15,$ffaaaaaa,15|"+
      "BOX,38,30,4,20,$ff444444,9|"+
      "BOX,30,470,20,4,$ff444444,8|"+
      "BOX,462,38,20,4,$ff444444,10|"+
      "BOX,470,462,4,20,$ff444444,11|"+
      "LOOP,0,20,0,0,10|"+
      "BOX,100,100,311,10,$ff883300,1|"+
      "TEXT,120,300,0,0,$aa00ffff,-1,PANEL 3,0,0,Impact,75|"+
      "NOISE,0,0,512,512,$ff335566|"+
      "DIRTY,0,0,512,512,$33556677|"+
      "#"

f+    "WALL WINDOW WOOD,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "LEAFS,0,0,0,0,$ff778899,9,,1|"+
      "LEAFS,0,0,0,0,$ff009900,10,,6|"+
      "LEAFS,0,0,0,0,$ff334455,11,,6|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff5577aa,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff5577aa,13|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff5577aa,13|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff5577aa,13|"+
      "LOOP,0,128,0,0,2|"+
      "BOX,128,130,256,61,$ff5577aa,13|"+
      "BOX,148,194,216,61,$ff5577aa,13|"+
      "BOX,0,448,512,64,$ff5577aa,15|"+
      "WOOD,168,144,178,160,$ff888888,5|"+
      "BOX,159,145,196,24,$ff554433,15|"+
      "LOOP,0,10,0,0,10|"+
      "BOX,169,169,176,9,$ff554433,13|"+
      "LEAFS,0,0,0,0,$ff778899,13,,1|"+
      "LEAFS,0,0,0,0,$ff009900,14,,6|"+
      "LEAFS,0,0,0,0,$ff334455,15,,6|"+
      "#"
      

f+    "WALL DOOR WOOD,512,512,1|"+
      "BRIK,8,16,6,0,$ff445588,8,,1,1|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,128,130,256,61,$ff5577aa,15|"+
      "LOOP,0,128,0,0,2|"+
      "BOX,138,194,236,61,$ff5577aa,15|"+
      "BOX,0,448,512,64,$ff5577aa,15|"+
      "WOOD,148,144,212,400,$ff112233,0|"+
      "LOOP,32,0,0,0,6|"+
      "WOOD,158,154,31,490,$ff224466,6|"+
      "WOOD,240,186,32,300,$ff334455,10,,30|"+
      "WOOD,158,186,192,32,$ff334455,10|"+
      "WOOD,158,448,192,32,$ff334455,10|"+
      "ELLIPSE,173,204,5,5,$ff999999,15|"+
      "ELLIPSE,333,204,5,5,$ff999999,15|"+
      "ELLIPSE,173,464,5,5,$ff999999,15|"+
      "ELLIPSE,333,464,5,5,$ff999999,15|"+
      "BOX,168,310,40,50,$ff444444,13|"+
      "BOX,178,330,40,10,$ff444444,15,,30|"+
      "#"

f+    "WALLWOOD DOOR WOOD,512,512,1|"+
      "BOX,0,0,512,512,$ff223344,1|"+
      "LOOP,0,32,0,0,16|"+
      "WOOD,0,0,512,31,$ff223344,3|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,0,2,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,-32,66,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,4|"+
      "BOX,448,2,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,480,66,64,60,$ff5577aa,15|"+
      "LOOP,0,128,0,0,3|"+
      "BOX,128,130,256,61,$ff5577aa,15|"+
      "LOOP,0,128,0,0,2|"+
      "BOX,138,194,236,61,$ff5577aa,15|"+
      "BOX,0,448,512,64,$ff5577aa,15|"+
      "WOOD,148,144,212,400,$ff112233,0|"+
      "LOOP,32,0,0,0,6|"+
      "WOOD,158,154,31,490,$ff224466,6|"+
      "WOOD,240,186,32,300,$ff334455,10,,30|"+
      "WOOD,158,186,192,32,$ff334455,10|"+
      "WOOD,158,448,192,32,$ff334455,10|"+
      "ELLIPSE,173,204,5,5,$ff999999,15|"+
      "ELLIPSE,333,204,5,5,$ff999999,15|"+
      "ELLIPSE,173,464,5,5,$ff999999,15|"+
      "ELLIPSE,333,464,5,5,$ff999999,15|"+
      "BOX,168,310,40,50,$ff444444,13|"+
      "BOX,178,330,40,10,$ff444444,15,,30|"+
      "#"

f+    "SPLASH,512,512,1|"+
      "BRIK,8,16,6,0,$ff446699,8,,1,1|"+
      "SPLASH,128,128,256,256,$ffff0000,-1|"+
      "SPLASH,200,100,200,200,$ff000088,-1|"+
      "SPLASH,340,50,200,200,$ff00ff00,-1|"+
      "SPLASH,0,350,200,200,$ff00ffff,-1|"+
      "SPLASH,0,0,200,200,$ffff00ff,-1|"+
      "#"

f+    "WOOD CRATE,512,512,1|"+
      "WOOD,0,0,512,512,$ff4477bb,2|"+
      "LOOP,64,0,0,0,8|"+
      "WOOD,0,0,58,512,$ff225599,6|"+
      "WOOD,0,224,512,64,$ff3366aa,9,,45|"+
      "WOOD,0,32,512,64,$ff4477bb,12|"+
      "WOOD,0,416,512,64,$ff4477bb,12|"+
      "TEXT,80,100,0,0,$88ffffff,-1,WOOD,10,0,Impact,120|"+
      "BOX,50,300,100,100,$8800ffff,-1|"+
      "TEXTBOX,55,305,90,90,$aa000000,-1,WARNING Handle with care or this box can explode and kill evety body in 1 Km. around. Your advice.,0,0,Arial,8|"+
      "TEXTBOX,350,355,110,90,$aa000000,-1,PureBasic is the best option for programmers and creative people.,-10,0,Arial,10|"+
      "ELLIPSE,64,64,5,5,$ff999999,15|"+
      "ELLIPSE,442,64,5,5,$ff999999,15|"+
      "ELLIPSE,64,442,5,5,$ff999999,15|"+
      "ELLIPSE,442,442,5,5,$ff999999,15|"+
      "#"

f+    "WALL,512,512,1|"+
      "BRIK,8,16,6,0,$ff446699,8,,1,1|"+
      "ELLIPSE,256,256,180,190,$550000ff,-1|"+
      "ELLIPSE,256,256,180,190,$99000000,-1,,0,6|"+
      "TEXT,10,200,650,340,$99ffffff,-1,Make Love!,-20,0,Impact,65|"+
      "TEXT,10,200,650,340,$99000000,-1,Make Love!,-20,4,Impact,65|"+
      "TEXT,10,290,350,340,$9900ffff,-1,Not war!,-10,0,Impact,105|"+
      "TEXT,10,290,350,340,$99000000,-1,Not war!,-10,6,Impact,105|"+
      "#"
If translation=Error: reply="Sorry, Im Spanish": Endif
benubi
Enthusiast
Enthusiast
Posts: 215
Joined: Tue Mar 29, 2005 4:01 pm

Re: Vectorial texture and normal map creator

Post by benubi »

That looks great!
Post Reply