WaBis

walter.bislins.ch

JSG3D: Vorlagen

Includes

#INCLUDE JsGraph3D.inc

NewGraph3D()

var graph = NewGraph3D( {
  // JsgGraph2D Stuff
  Id:              'JsGraph1',
  Width:           '100%',
  Height:          '75%',
  DrawFunc:        DrawModel, // function(g){},
  DeferedDrawFunc: DrawModelLabels, 
  BeforeResetFunc: function(g){},
  TextRendering:   'canvas|html',
  AutoReset:       true,
  HighResolution:  true,
  BorderWidth:     1,
  BorderColor:     '',
  ScaleRef:        800,
  AutoScalePix:    false,
  LimitScalePix:   true,
  ScalePixInt:     false,

  // JsGraph3D Stuff
  ShowProgress:    true,
  SyncMode:        false,
  BeforeDrawFunc:  function(g){},
  AfterDrawFunc:   function(g){},

  // DefaultEleData
  Attr:            { 
    JsgEleAttr 
  },
  AreaDrawMode:    3,
  PointDrawMode:   3,
  DrawBackface:    true,
  AreaAttrFunc:    function( g, JsgGraphEle, JsgEleAttr, ScaProd ){},
  LineAttrFunc:    function( g, JsgGraphEle, JsgEleAttr ){},
  PointAttrFunc:   function( g, JsgGraphEle, JsgEleAttr ){},
  Lighting:        { 
    JsgEleLighting 
  },
  BackLighting:    { 
    JsgEleLighting 
  },
  ContourMode:     false,
  ContourSense:    0.1,
  ContourColor:    JsgColor.Black(),
  ContourWidth:    7,

  // Camera Stuff
  Aperture:       1,
  Zoom:           1,
  SceneSize:      1,
  ScreenSize:     1,
  ObjectZExtend:  0,
  CamViewCenter:  [0,0,0],
  CamPos:         [100,0,0],
  CamUp:          [0,0,1],
  HighResolution: 'on',
  CamHAng:        0,
  CamVAng:        0,
  CamDist:        100,

  // Scene Stuff
  AmbientLight: JsgColor.White(),
  CamLight: JsgColor.White(),
  LightSourceList: [
    {
      LightColor: JsgColor.White(),
      DiffInt:    1,
      SpecInt:    1,
      LightDir:   [0,0,1],
      LightPos:   null, // [x,y,z],
      HAng:       0,
      VAng:       0,
      Dist:       100,
      RefPoint:   [0,0,0]
    },
  ],

  // Plane Stuff
  Plane: {
    Pos:  [0,0,0], 
    XDir: [0,1,0],
    YDir: [0,0,1]
  },

  // Formating and Additional Stuff
  GraphClass:    'JsGraph',
  GraphFormat:   'VMargin',
  MinLineWidth:  0.5,
  MinTextSize:   1,
  MinMarkerSize: 1,
  DefaultAttrs:  { -> [[SetAttrs()]] }
} );

  // JsgEleAttr Stuff
  Attr: { 
    AreaColor:         JsgColor.RGB(0.8,0.8,1),
    AreaBackColor:     JsgColor.RGB(1,0.8,0.8),
    LineColor:         JsgColor.RGB(0,0,0.5), 
    AreaBackLineColor: JsgColor.RGB(0.5,0,0),
    LineWidth:         1,
    Symbol:            'Circle',
    SymbSize:          8
  },

  // JsgLighting Stuff
  Lighting: { 
    ApplyCamLight:   true,
    ApplyAmbient:    true,
    ApplyPhong:      false,
    BlackAndWhite:   false,
    ColorResolution: 0,
    Dimm:            1,
    CamRefl:         1.0,
    AmbiRefl:        0.2,
    DiffRefl:        0.5,
    SpecRefl:        0.5,
    Roughness:       1.0,
    Shiny:           16,
    DiffXRay:        0,
    SpecXRay:        0.9
  },


NewGraph3D(), Globale Properties, JsGraph3D Properties, JsgEleData, JsgEleAttr, JsgEleLighting, JsgPlane

  g.SetDrawFunc( DrawFunc3D );  // function( g ){};
  g.Reset3D();
  g.SaveAll();
  g.SetAll( params -> NewGraph3D() );
  g.StopDrawing();
  g.SetSyncMode( false );

SetDrawFunc(), Reset3D(), SaveAll(), SetAll(), StopDrawing(), SetSyncMode()

3D-Grafik

  g.NewPoly();
  g.AddPointToPoly3D( JsgVect3 );
  g.DrawPoly();

  g.PenUp();
  g.MoveTo3D( JsgVect3 );
  g.LineTo3D( JsgVect3 );

  g.Line3D( JsgVect3, JsgVect3, append=false );
  g.Arrow3D( JsgVect3, JsgVect3, Variant=1, Mode=3 );

  g.Polygon3D( JsgVect3List, Mode=1 );
  g.PolygonArrow3D( JsgVect3List, Variant=1, LineMode=1, ArrowMode=3 );

  g.Text3D( Text, JsgVect3, [Width] );
  g.Text3D( Text, JsgVect3, Mode=0 );
  var box = g.GetTextBox3D( Text, JsgVect3, [Width] );

  g.Marker3D( JsgVect3[List], Mode=3, [JsgMat2] );

NewPoly(), DrawPoly(), AddPointToPoly3D(), PenUp(), MoveTo3D(), LineTo3D(), Line3D(), Arrow3D(), Polygon3D(), PolygonArrow3D(), Text3D(), GetTextBox3D(), Marker3D()

Pfad Funktionen

  g.OpenPath();
  g.ClosePath();
  g.Path( Mode=1, Clear=true );

  g.Clip( Clear=true );
  g.ClearPath();

OpenPath(), ClosePath(), Path(), Clip(), ClearPath()

Weitere Infos zur Seite
Erzeugt Mittwoch, 24. Februar 2016
von wabis
Zum Seitenanfang
Geändert Donnerstag, 25. Februar 2016
von wabis