GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.waspscripts.com — Models Models¶Types and methods that allows you to load and project 3D models. This is mostly for internal use for RSObjects and RSEntities but you may use this directly if you need and know what you are doing. If you are curious about how the projection works you should read about Projection.
TModelFace type¶Type that represents a model face. A model face consists of 3 vertices indices making a triangle and a “material” index to give the face a color. A 3D model will have several of these. TModel type¶Type that represents a 3D model. A model in it’s basic form confists of several Model.LoadMTL¶procedure TModel.LoadMTL(fileName: string); Read and parses a material .mtl file and loads it’s data into the This is used to load materials (colors) into the Model.LoadOBJ¶procedure TModel.LoadOBJ(fileName: string); Read and parses a model .obj file and loads it’s data into the This is used load vertices and faces information into the Model.Construct¶function TModel.Construct(objFile: String; mtlFile: String = ''): TModel; static; Creates a new If Example: {$I WaspLib/main.simba} var model: TModel; begin model := new TModel('path/to/my/model.obj'); end. Model.Scale¶procedure TModel.Scale(factor: Single); Scales a model by the Example: {$I WaspLib/main.simba} var img: TImage; model: TModel; tpa: TPointArray; i: Integer; begin model := new TModel('path/to/my/model.obj'); while True do begin for i := 0 to 100 do begin img := Target.GetImage(MainScreen.Bounds); model.Scale(0.99); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); model.DrawModel(img, tpa, True); img.Show(); end; for i := 0 to 100 do begin img := Target.GetImage(MainScreen.Bounds); model.Scale(1.01); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); model.DrawModel(img, tpa, True); img.Show(); end; end; end.
Model.Rotate¶procedure TModel.Rotate(radians: Single); Rotates a model in the X axis by Example: {$I WaspLib/main.simba} var img: TImage; model: TModel; tpa: TPointArray; begin model := new TModel('path/to/my/model.obj'); while True do begin img := Target.GetImage(MainScreen.Bounds); model.Rotate(0.005); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); model.DrawModel(img, tpa, True); img.Show(); end; end.
Model.Offset¶procedure TModel.Offset(value: TVector3); Offsets a model in the 3D space by Example: {$I WaspLib/main.simba} var img: TImage; model: TModel; tpa: TPointArray; i: Integer; begin model := new TModel('path/to/my/model.obj'); while True do begin for i := 1 to 600 do begin img := Target.GetImage(MainScreen.Bounds); case i of 1..100: model.Offset([0,0,0.1]); 101..200: model.Offset([0,0,-0.1]); 201..300: model.Offset([0.1,0,0]); 301..400: model.Offset([-0.1,0,0]); 401..500: model.Offset([0,0.1,0]); 501..600: model.Offset([0,-0.1,0]); end; tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); model.DrawModel(img, tpa, True); img.Show(); end; end; end.
Model.GetArea¶function TModel.GetArea(projection: TPointArray): TPointArray; Takes a model projection as a It’s very useful to get clickboxes of models. Example: {$I WaspLib/main.simba} var model: TModel; tpa: TPointArray; begin model := new TModel('path/to/my/model.obj'); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); ShowOnTarget(model.GetArea(tpa)); end.
Model.GetEdges¶function TModel.GetEdges(projection: TPointArray): TPointArray; Takes a model projection as a Essentially gives you the model outline. Example: {$I WaspLib/main.simba} var model: TModel; tpa: TPointArray; begin model := new TModel('path/to/my/model.obj'); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); ShowOnTarget(model.GetEdges(tpa)); end.
Model.DrawModel¶procedure TModel.DrawModel(img: TImage; projection: TPointArray; outline: Boolean = True); Draws a model Example: {$I WaspLib/main.simba} var img: TImage; model: TModel; tpa: TPointArray; begin img := Target.GetImage(MainScreen.Bounds); model := new TModel('path/to/my/model.obj'); tpa := Projection.ProjectModel(model, Minimap.Center.ToVec3(), Minimap.CompassRadians, 0); model.DrawModel(img, tpa, True); img.Show(); end.
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |