Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-20-2012, 06:50 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Attempting to render 3D shapes

Hey, tried playing around rendering a hollow cylinder, sort of worked.
Here is my script:
PHP Code:
//#CLIENTSIDE
function onCreated(){
  const 
radius 200//The radius of the cylinder.
  
const detail 2//How much detail to show.
  
const ntsc false//NTSC colours, sort of.
  
const blurlevel 1//To skew the render.
  
const spinspeed 0.05//How fast it rotates.
  
DrawGUI();
}
function 
DrawGUI(){
  
this.imgs 0;
  
temp.tx screenwidth/250;
  
temp.ty screenheight/50;
  
//Loops through and shows all polygons for the render.
  
for(temp.0radius*detail++){
    
this.imgs.add(i);
    
temp.tx += sin(i)*radius//Changes the positioning to a circle.
    
temp.ty -= cos(i)*radius//Same
    
with(findimg(1+i)){
      
layer 4;
      
polygon = {
        
temp.txtemp.ty,
        
temp.tx radius/2,
        
temp.ty radius/2,
      };
      
useowncenter true;
      
rotationcenter = {temp.tx -radius/2temp.ty -radius/2};
    }
  }
  
onTimeout();
}
function 
onTimeout(){
  
//Loops through all images and rotates them.
  
for(temp.this.imgs){
    
findimg(1+this.imgs[i]).rotation += spinspeed;
    if(
ntsc){
      
findimg(1+this.imgs[i]).red random(0,1);
      
findimg(1+this.imgs[i]).green random(0,1);
      
findimg(1+this.imgs[i]).blue random(0,1);
    }
    
//Skews the polygons.
    
findimg(1+this.imgs[i]).stretchx random(1,blurlevel);
    
findimg(1+this.imgs[i]).stretchy random(1,blurlevel);
  }
  
settimer(0.05);

The script can cause the Graal client to become quite laggy if rendering a large cylinder with a high detail value.
Not quite sure how to actually make the shape proper 3D.
In which I could rotate it on each axis, x,y,z.
If anyone has some formulas they'd like to share it's more than welcome.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 12-20-2012 at 07:01 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.