📄 control.java
字号:
import vrml.*;
import vrml.node.*;
import vrml.field.*;
public class Control extends Script
{
CtrPanel panel;
SFFloat ambient, shin, trans;
SFColor dColor, eColor, sColor;
SFRotation rotation;
SFVec3f position;
SFBool status;
public void initialize()
{
Node mat = (Node)((SFNode)getField("mat")).getValue();
Node box=(Node)((SFNode)getField("box")).getValue();
panel = new CtrPanel(this);
status=(SFBool)getField("status");
ambient = (SFFloat)mat.getExposedField("ambientIntensity");
dColor = (SFColor)mat.getExposedField("diffuseColor");
eColor = (SFColor)mat.getExposedField("emissiveColor");
shin = (SFFloat)mat.getExposedField("shininess");
sColor = (SFColor)mat.getExposedField("specularColor");
trans = (SFFloat)mat.getExposedField("transparency");
rotation = (SFRotation)box.getExposedField("rotation");
}
public void processEvent(Event ev)
{
if(ev.getName().equals("clicked"))
{
ConstSFBool v = (ConstSFBool)ev.getValue();
if(v.getValue())
{
if(status.getValue())
{
panel.map();
}
else
{
panel.hide();
}
status.setValue(!status.getValue());
}
}
}
public void shutdown()
{
panel.dispose();
}
public float getAmb()
{
return(ambient.getValue());
}
public void setAmb(float val)
{
ambient.setValue(val);
}
public void getDcolor(float[] rgb)
{
dColor.getValue(rgb);
}
public void setDcolor(float[] val)
{
dColor.setValue(val);
}
public void getEcolor(float[] rgb)
{
eColor.getValue(rgb);
}
public void setEcolor(float[] val)
{
eColor.setValue(val);
}
public float getShi()
{
return(shin.getValue());
}
public void setShi(float val)
{
shin.setValue(val);
}
public void getScolor(float[] rgb)
{
sColor.getValue(rgb);
}
public void setScolor(float[] val)
{
sColor.setValue(val);
}
public float getTrans()
{
return(trans.getValue());
}
public void setTrans(float val)
{
trans.setValue(val);
}
public void setRotation(float[] newrotation)
{
rotation.setValue(newrotation);
}
public void getRotation(float[] rot)
{
rotation.getValue(rot);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -