找回密碼
 注冊帳號

掃一掃,訪問微社區

camera.onprerender 在渲染之前

2015-1-4 04:07| 發布者: 楊炎| 查看: 2732| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: camera.onprerender 在渲染之前functiononprerender() : voiddescription描述onprerender is called before a camera starts rendering the scene.、onprerender在相機開始渲染場景之前調用。this message is sent t ...

camera.onprerender 在渲染之前

functiononprerender() : void

description描述

onprerender is called before a camera starts rendering the scene.、

onprerender在相機開始渲染場景之前調用。

this message is sent to all scripts attached to the camera.

這個消息被發送到所有附加在相機上的腳本

note that if you change camera's viewing parameters (e.g.fieldofview) here, they will only take effect the next frame. do that inonprecullinstead.

注意如果你在這里改變了相機的視野參數(例如fieldofview),它們將只影響下一幀,onprecull 用代替。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

private bool revertfogstate = false;

void onprerender() {

revertfogstate =rendersettings.fog;

rendersettings.fog= enabled;

}

void onpostrender() {

rendersettings.fog= revertfogstate;

}

}

// this script lets you enable/disable fog per camera.

//這個腳本讓你在每個相機開啟/禁用霧效

// by enabling or disabling the script in the title of the inspector

//在檢視面板開啟或禁用這個腳本

// you can turn fog on or off per camera.

//在每個相機可以開啟/禁用霧效

private var revertfogstate = false;

function onprerender () {

revertfogstate = rendersettings.fog;

rendersettings.fog= enabled;

}

function onpostrender () {

rendersettings.fog= revertfogstate;

}

相關閱讀

文章點評
相關文章
女校游泳队彩金