mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
+38
-12
@@ -90,20 +90,44 @@ export class Material extends Asset {
|
||||
this.update();
|
||||
}
|
||||
|
||||
public setProperty(name: string, val: any, passIdx = 0) {
|
||||
console.assert(passIdx < this._passes.length, 'illegal pass index.');
|
||||
this._props[passIdx][name] = val;
|
||||
const pass = this._passes[passIdx];
|
||||
const handle = pass.getHandleFromName(name);
|
||||
pass.setUniform(handle, val);
|
||||
public setProperty(name: string, val: any, passIdx?: number) {
|
||||
if (passIdx === undefined) { // set property for all applicable passes
|
||||
const passes = this._passes;
|
||||
const len = passes.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const handle = passes[i].getHandleFromName(name);
|
||||
if (handle === undefined) { continue; }
|
||||
passes[i].setUniform(handle, val);
|
||||
this._props[i][name] = val;
|
||||
}
|
||||
} else {
|
||||
if (CC_DEBUG && passIdx >= this._passes.length) { console.warn(`illegal pass index: ${passIdx}.`); return; }
|
||||
const pass = this._passes[passIdx];
|
||||
const handle = pass.getHandleFromName(name);
|
||||
if (CC_DEBUG && handle === undefined) { console.warn(`illegal property name: ${name}.`); return; }
|
||||
pass.setUniform(handle, val);
|
||||
this._props[passIdx][name] = val;
|
||||
}
|
||||
}
|
||||
|
||||
public setTexture(name: string, val: TextureBase, passIdx = 0) {
|
||||
console.assert(passIdx < this._passes.length, 'illegal pass index.');
|
||||
this._textures[passIdx][name] = val;
|
||||
const pass = this._passes[passIdx];
|
||||
const binding = pass.getBindingFromName(name);
|
||||
pass.bindTextureView(binding, val._texView);
|
||||
public setTexture(name: string, val: TextureBase, passIdx?: number) {
|
||||
if (passIdx === undefined) { // set property for all applicable passes
|
||||
const passes = this._passes;
|
||||
const len = passes.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const binding = passes[i].getBindingFromName(name);
|
||||
if (binding < 0) { continue; }
|
||||
passes[i].bindTextureView(binding, val._texView);
|
||||
this._textures[i][name] = val;
|
||||
}
|
||||
} else {
|
||||
if (CC_DEBUG && passIdx >= this._passes.length) { console.warn(`illegal pass index: ${passIdx}.`); return; }
|
||||
const pass = this._passes[passIdx];
|
||||
const binding = pass.getBindingFromName(name);
|
||||
if (CC_DEBUG && binding < 0) { console.warn(`illegal texture name: ${name}.`); return; }
|
||||
pass.bindTextureView(binding, val._texView);
|
||||
this._textures[passIdx][name] = val;
|
||||
}
|
||||
}
|
||||
|
||||
public copy(mat: Material) {
|
||||
@@ -146,12 +170,14 @@ export class Material extends Asset {
|
||||
if (!props) { props = this._props[i] = {}; }
|
||||
for (const p of Object.keys(props)) {
|
||||
const handle = pass.getHandleFromName(p);
|
||||
if (handle === undefined) { continue; }
|
||||
pass.setUniform(handle, props[p]);
|
||||
}
|
||||
let textures = this._textures[i];
|
||||
if (!textures) { textures = this._textures[i] = {}; }
|
||||
for (const t of Object.keys(textures)) {
|
||||
const binding = pass.getBindingFromName(t);
|
||||
if (binding === undefined) { continue; }
|
||||
pass.bindTextureView(binding, textures[t]._texView);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
// @ts-check
|
||||
import Component from '../../components/CCComponent';
|
||||
import { Component } from '../../components/component';
|
||||
import { ccclass, property, executionOrder, menu, executeInEditMode } from '../../core/data/class-decorator';
|
||||
import Enum from '../../core/value-types/enum';
|
||||
import AnimationClip, { AnimationTarget, AnimationSampler } from '../assets/animation-clip';
|
||||
|
||||
@@ -28,7 +28,7 @@ import { toRadian } from '../../core/vmath';
|
||||
import { ccclass, menu, property, executeInEditMode } from "../../core/data/class-decorator";
|
||||
import { Color, Enum, Rect } from '../../core/value-types';
|
||||
import enums from '../../renderer/enums';
|
||||
import Component from '../../components/CCComponent';
|
||||
import { Component } from '../../components/component';
|
||||
|
||||
/**
|
||||
* @typedef {import('../../core/value-types/index').Color} Color
|
||||
|
||||
@@ -27,7 +27,7 @@ import renderer from '../../renderer/index';
|
||||
import { Color, Enum } from '../../core/value-types';
|
||||
import { toRadian } from '../../core/vmath';
|
||||
import { ccclass, menu, property, executeInEditMode } from "../../core/data/class-decorator";
|
||||
import Component from '../../components/CCComponent';
|
||||
import { Component } from '../../components/component';
|
||||
|
||||
/**
|
||||
* !#en The light source type
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
import Component from '../../../components/CCComponent';
|
||||
import { Component } from '../../../components/component';
|
||||
import { vec3, vec2, mat4, quat, randomRangeInt, pseudoRandom } from '../../../core/vmath';
|
||||
import registry from '../../misc/registry';
|
||||
import Gradient, { ColorKey, AlphaKey } from './animator/gradient';
|
||||
|
||||
@@ -117,7 +117,7 @@ export class PhysicsBody {
|
||||
return this._cannonBody.force;
|
||||
}
|
||||
|
||||
public applyForce(force: cc.Vec3, position?: cc.Vec3) {
|
||||
public applyForce(force: Vec3, position?: Vec3) {
|
||||
if (!position) {
|
||||
position = this._cannonBody.position;
|
||||
}
|
||||
@@ -295,7 +295,7 @@ export class PhysicsBody {
|
||||
this.pullTransform();
|
||||
}
|
||||
|
||||
private _pullScale(scale: cc.Vec3) {
|
||||
private _pullScale(scale: Vec3) {
|
||||
let shapeUpdated = false;
|
||||
this._shapes.forEach((shape) => {
|
||||
let calcShapeOffset = false;
|
||||
@@ -359,9 +359,9 @@ export class PhysicsBody {
|
||||
export class PhysicsShape {
|
||||
// public __debugNodeName: string = '';
|
||||
|
||||
private _scale: cc.Vec3 = new cc.Vec3(1.0, 1.0, 1.0);
|
||||
private _scale: Vec3 = new Vec3(1.0, 1.0, 1.0);
|
||||
|
||||
private _center: cc.Vec3 = new cc.Vec3(0, 0, 0);
|
||||
private _center: Vec3 = new Vec3(0, 0, 0);
|
||||
|
||||
public _centerChanged = true;
|
||||
|
||||
@@ -395,12 +395,12 @@ export class PhysicsShape {
|
||||
}
|
||||
|
||||
export class PhysicsBoxShape extends PhysicsShape {
|
||||
private _size: cc.Vec3;
|
||||
private _size: Vec3;
|
||||
|
||||
constructor(size: Vec3) {
|
||||
super(new CANNON.Box(new CANNON.Vec3(size.x / 2, size.y / 2, size.z / 2)));
|
||||
|
||||
this._size = new cc.Vec3(size.x, size.y, size.z);
|
||||
this._size = new Vec3(size.x, size.y, size.z);
|
||||
}
|
||||
|
||||
public get size() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import Component from '../../../../components/CCComponent';
|
||||
import { Component } from '../../../../components/component';
|
||||
import { ccclass } from '../../../../core/data/class-decorator';
|
||||
import { PhysicsBody } from '../body';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import CANNON from 'cannon';
|
||||
import { Vec3 } from '../../../core/value-types';
|
||||
import { PhysicsMaterial } from '../../assets/physics/material';
|
||||
import { DataFlow, PhysicsBody, PhysicsShape } from './body';
|
||||
import { ContactMaterial } from './contact-material';
|
||||
@@ -45,8 +46,8 @@ export class PhysicsWorld {
|
||||
|
||||
constructor() {
|
||||
this._defaultMaterial = new PhysicsMaterial();
|
||||
this._defaultContactMaterial = new ContactMaterial(
|
||||
this._defaultMaterial, this._defaultMaterial, { friction: 0.3, restitution: 0.0 });
|
||||
// @ts-ignore
|
||||
this._defaultContactMaterial = new ContactMaterial(this._defaultMaterial, { friction: 0.3, restitution: 0.0 });
|
||||
|
||||
this._cannonWorld = new CANNON.World();
|
||||
setWrap<PhysicsWorld>(this._cannonWorld, this);
|
||||
@@ -82,7 +83,7 @@ export class PhysicsWorld {
|
||||
* Ray cast, and return information of the closest hit.
|
||||
* @return True if any body was hit.
|
||||
*/
|
||||
public raycastClosest(from: cc.Vec3, to: cc.Vec3, options: RaycastOptions, result: RaycastResult): boolean {
|
||||
public raycastClosest(from: Vec3, to: Vec3, options: RaycastOptions, result: RaycastResult): boolean {
|
||||
const hit = (this._cannonWorld as any).raycastClosest(from, to, toCannonRaycastOptions(options), result._cannonResult);
|
||||
return hit;
|
||||
}
|
||||
@@ -91,7 +92,7 @@ export class PhysicsWorld {
|
||||
* Ray cast, and stop at the first result. Note that the order is random - but the method is fast.
|
||||
* @return True if any body was hit.
|
||||
*/
|
||||
public raycastAny(from: cc.Vec3, to: cc.Vec3, options: RaycastOptions, result: RaycastResult): boolean {
|
||||
public raycastAny(from: Vec3, to: Vec3, options: RaycastOptions, result: RaycastResult): boolean {
|
||||
const hit = (this._cannonWorld as any).raycastAny(from, to, toCannonRaycastOptions(options), result._cannonResult);
|
||||
return hit;
|
||||
}
|
||||
@@ -100,7 +101,7 @@ export class PhysicsWorld {
|
||||
* Ray cast against all bodies. The provided callback will be executed for each hit with a RaycastResult as single argument.
|
||||
* @return True if any body was hit.
|
||||
*/
|
||||
public raycastAll(from: cc.Vec3, to: cc.Vec3, options: RaycastOptions, callback: (result: RaycastResult) => void): boolean {
|
||||
public raycastAll(from: Vec3, to: Vec3, options: RaycastOptions, callback: (result: RaycastResult) => void): boolean {
|
||||
return (this._cannonWorld as any).raycastAll(from, to, toCannonRaycastOptions(options), (cannonResult: CANNON.RaycastResult) => {
|
||||
const result = new RaycastResult();
|
||||
result._cannonResult = cannonResult;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Component from '../../components/CCComponent';
|
||||
import { Component } from '../../components/component';
|
||||
|
||||
class RenderSystemActorListener {
|
||||
constructor() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@ts-check
|
||||
import { _decorator } from '../../core/data/index';
|
||||
import { Material } from "../assets/material";
|
||||
import Component from "../../components/CCComponent";
|
||||
import { Component } from "../../components/component";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('cc.RenderableComponent')
|
||||
|
||||
@@ -28,7 +28,7 @@ import { box } from '../primitive/index';
|
||||
import { Material } from '../assets/material';
|
||||
import { ccclass, property, menu, executeInEditMode } from '../../core/data/class-decorator';
|
||||
import TextureCube from '../assets/texture-cube';
|
||||
import Component from '../../components/CCComponent';
|
||||
import { Component } from '../../components/component';
|
||||
|
||||
/**
|
||||
* !#en The Skybox Component
|
||||
|
||||
@@ -62,7 +62,7 @@ var EventType = cc.Enum({
|
||||
/**
|
||||
* !#en Emit when pause animation
|
||||
* !#zh 暂停播放时触发
|
||||
* @property {String} PAUSE
|
||||
* @property {String} PAUSE
|
||||
* @static
|
||||
*/
|
||||
PAUSE: 'pause',
|
||||
@@ -91,7 +91,7 @@ var EventType = cc.Enum({
|
||||
|
||||
/**
|
||||
* !#en The animation component is used to play back animations.
|
||||
*
|
||||
*
|
||||
* Animation provide several events to register:
|
||||
* - play : Emit when begin playing animation
|
||||
* - stop : Emit when stop playing animation
|
||||
@@ -101,7 +101,7 @@ var EventType = cc.Enum({
|
||||
* - finished : Emit when finish playing animation
|
||||
*
|
||||
* !#zh Animation 组件用于播放动画。
|
||||
*
|
||||
*
|
||||
* Animation 提供了一系列可注册的事件:
|
||||
* - play : 开始播放时
|
||||
* - stop : 停止播放时
|
||||
@@ -109,14 +109,14 @@ var EventType = cc.Enum({
|
||||
* - resume : 恢复播放时
|
||||
* - lastframe : 假如动画循环次数大于 1,当动画播放到最后一帧时
|
||||
* - finished : 动画播放完成时
|
||||
*
|
||||
*
|
||||
* @class Animation
|
||||
* @extends Component
|
||||
* @uses EventTarget
|
||||
*/
|
||||
var Animation = cc.Class({
|
||||
name: 'cc.Animation',
|
||||
extends: require('./CCComponent'),
|
||||
extends: require('./component'),
|
||||
mixins: [EventTarget],
|
||||
|
||||
editor: CC_EDITOR && {
|
||||
@@ -305,7 +305,7 @@ var Animation = cc.Class({
|
||||
|
||||
if (state) {
|
||||
this.enabled = true;
|
||||
|
||||
|
||||
var animator = this._animator;
|
||||
if (animator.isPlaying && state.isPlaying) {
|
||||
if (state.isPaused) {
|
||||
@@ -488,7 +488,7 @@ var Animation = cc.Class({
|
||||
},
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* !#en
|
||||
* Remove clip from the animation list. This will remove the clip and any animation states based on it.
|
||||
* If there are animation states depand on the clip are playing or clip is defaultClip, it will not delete the clip.
|
||||
* But if force is true, then will always remove the clip and any animation states based on it. If clip is defaultClip, defaultClip will be reset to null
|
||||
@@ -521,7 +521,7 @@ var Animation = cc.Class({
|
||||
else {
|
||||
if (!CC_TEST) cc.warnID(3902);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state && state.isPlaying) {
|
||||
@@ -537,7 +537,7 @@ var Animation = cc.Class({
|
||||
});
|
||||
|
||||
if (state) {
|
||||
delete this._nameToState[state.name];
|
||||
delete this._nameToState[state.name];
|
||||
}
|
||||
},
|
||||
|
||||
@@ -565,7 +565,7 @@ var Animation = cc.Class({
|
||||
|
||||
|
||||
/**
|
||||
* !#en
|
||||
* !#en
|
||||
* Register animation event callback.
|
||||
* The event arguments will provide the AnimationState which emit the event.
|
||||
* When play an animation, will auto register the event callback to the AnimationState, and unregister the event callback from the AnimationState when animation stopped.
|
||||
@@ -577,7 +577,7 @@ var Animation = cc.Class({
|
||||
* @param {String} type - A string representing the event type to listen for.
|
||||
* @param {Function} callback - The callback that will be invoked when the event is dispatched.
|
||||
* The callback is ignored if it is a duplicate (the callbacks are unique).
|
||||
* @param {cc.AnimationState} state
|
||||
* @param {cc.AnimationState} state
|
||||
* @param {Object} [target] - The target (this object) to invoke the callback, can be null
|
||||
* @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback
|
||||
* from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE.
|
||||
@@ -592,7 +592,7 @@ var Animation = cc.Class({
|
||||
* onPlay: function (type, state) {
|
||||
* // callback
|
||||
* }
|
||||
*
|
||||
*
|
||||
* // register event to all animation
|
||||
* animation.on('play', this.onPlay, this);
|
||||
*/
|
||||
@@ -658,7 +658,7 @@ var Animation = cc.Class({
|
||||
|
||||
_createStates: function() {
|
||||
this._nameToState = js.createMap(true);
|
||||
|
||||
|
||||
// create animation states
|
||||
var state = null;
|
||||
var defaultClipState = false;
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
const misc = require('../utils/misc');
|
||||
const Component = require('./CCComponent');
|
||||
const AudioClip = require('../assets/CCAudioClip');
|
||||
import * as misc from '../core/utils/misc';
|
||||
import { Component } from './component';
|
||||
import AudioClip from '../assets/CCAudioClip';
|
||||
|
||||
/**
|
||||
* !#en Audio Source.
|
||||
|
||||
@@ -29,7 +29,7 @@ import AffineTrans from '../core/value-types/affine-transform';
|
||||
import mat4 from '../core/vmath/mat4';
|
||||
import vec2 from '../core/vmath/vec2';
|
||||
import vec3 from '../core/vmath/vec3';
|
||||
import Component from '../components/CCComponent';
|
||||
import { Component } from '../components/component';
|
||||
// TODO fix import from renderer
|
||||
import { Camera as Renderer_Camera} from '../renderer/scene/camera';
|
||||
import {default as Renderer_View} from '../renderer/core/view';
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
import Camera from '../camera/CCCamera';
|
||||
import Component from './CCComponent';
|
||||
import { Component } from './component';
|
||||
import {ccclass, property, executeInEditMode, menu, help, disallowMultiple} from '../core/data/class-decorator';
|
||||
|
||||
/**
|
||||
@@ -240,4 +240,4 @@ export default class Canvas extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
cc.Canvas = Canvas;
|
||||
cc.Canvas = Canvas;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
const Component = require('./CCComponent');
|
||||
import { Component } from './component';
|
||||
const ImageAsset = require('../assets/image-asset');
|
||||
|
||||
let WXSubContextView;
|
||||
@@ -37,7 +37,7 @@ if (!CC_EDITOR && !CC_WECHATGAME) {
|
||||
else {
|
||||
/**
|
||||
* !#en WXSubContextView is a view component which controls open data context viewport in Wechat game platform.<br/>
|
||||
* The component's node size decide the viewport of the sub context content in main context,
|
||||
* The component's node size decide the viewport of the sub context content in main context,
|
||||
* the entire sub context texture will be scaled to the node's bounding box area.<br/>
|
||||
* This component provides multiple important features:<br/>
|
||||
* 1. Sub context could use its own resolution size and policy.<br/>
|
||||
@@ -45,7 +45,7 @@ else {
|
||||
* 3. Resolution of sub context content could be increased.<br/>
|
||||
* 4. User touch input is transformed to the correct viewport.<br/>
|
||||
* 5. Texture update is handled by this component. User don't need to worry.<br/>
|
||||
* One important thing to be noted, whenever the node's bounding box change,
|
||||
* One important thing to be noted, whenever the node's bounding box change,
|
||||
* you need to manually reset the viewport of sub context using updateSubContextViewport.
|
||||
* !#zh WXSubContextView 可以用来控制微信小游戏平台开放数据域在主域中的视窗的位置。<br/>
|
||||
* 这个组件的节点尺寸决定了开放数据域内容在主域中的尺寸,整个开放数据域会被缩放到节点的包围盒范围内。<br/>
|
||||
@@ -134,4 +134,4 @@ else {
|
||||
|
||||
}
|
||||
|
||||
cc.WXSubContextView = module.exports = WXSubContextView;
|
||||
cc.WXSubContextView = module.exports = WXSubContextView;
|
||||
|
||||
Vendored
+48
@@ -0,0 +1,48 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
import { CCObject } from '../core/data/object';
|
||||
import { getClassName, value } from '../core/utils/js';
|
||||
import IDGenerator from '../core/utils/id-generator';
|
||||
import { ccclass, property } from '../core/data/class-decorator';
|
||||
import Node from '../scene-graph/node';
|
||||
|
||||
export class Component extends CCObject {
|
||||
node: Node;
|
||||
uuid: string;
|
||||
enabled: boolean;
|
||||
enabledInHierarchy: boolean;
|
||||
|
||||
addComponent(typeOrClassName: Function | string): Component;
|
||||
getComponent(typeOrClassName: Function | string): Component;
|
||||
getComponents(typeOrClassName: Function | string): Component[];
|
||||
getComponentInChildren(typeOrClassName: Function | string): Component;
|
||||
getComponentsInChildren(typeOrClassName: Function | string): Component[];
|
||||
schedule(callback: Function, interval: number, repeat: number, delay: number): void;
|
||||
scheduleOnce(callback: Function, delay: number): void;
|
||||
unschedule(callback: Function): void;
|
||||
unscheduleAllCallbacks(): void;
|
||||
}
|
||||
@@ -722,4 +722,4 @@ value(Component, '_registerEditorProps', function (cls, props) {
|
||||
Component.prototype.__scriptUuid = '';
|
||||
|
||||
cc.Component = Component;
|
||||
export default Component;
|
||||
export { Component };
|
||||
@@ -24,7 +24,7 @@
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
export {default as Component} from './CCComponent';
|
||||
export {Component} from './component';
|
||||
export {default as EventHandler} from './CCComponentEventHandler';
|
||||
export {default as MissingScript} from './missing-script';
|
||||
export {default as Canvas} from './CCCanvas';
|
||||
export {default as Canvas} from './CCCanvas';
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
import {_getClassById} from '../core/utils/js';
|
||||
import {BUILTIN_CLASSID_RE} from '../core/utils/misc';
|
||||
import Component from './CCComponent';
|
||||
import { Component } from './component';
|
||||
import {ccclass, property, inspector} from '../core/data/class-decorator';
|
||||
|
||||
/*
|
||||
@@ -48,7 +48,7 @@ class MissingClass {
|
||||
@ccclass('cc.MissingScript')
|
||||
@inspector('packages://inspector/inspectors/comps/missing-script.js')
|
||||
export default class MissingScript extends Component {
|
||||
|
||||
|
||||
//_scriptUuid: {
|
||||
// get: function () {
|
||||
// var id = this._$erialized.__type__;
|
||||
|
||||
@@ -33,7 +33,7 @@ export class WebGLStateCache {
|
||||
this.glTex2DUnits = new Array<WebGLTexUnit>(GFX_MAX_TEXTURE_UNITS);
|
||||
this.glTexCubeUnits = new Array<WebGLTexUnit>(GFX_MAX_TEXTURE_UNITS);
|
||||
this.viewport = { left: 0.0, top: 0.0, width: 0.0, height: 0.0, minDepth: 0.0, maxDepth: 0.0};
|
||||
this.scissorRect = { left: 0.0, top: 0.0, width: 0.0, height: 0.0};
|
||||
this.scissorRect = { x: 0.0, y: 0.0, width: 0.0, height: 0.0};
|
||||
this.rs = new GFXRasterizerState;
|
||||
this.dss = new GFXDepthStencilState;
|
||||
this.bs = new GFXBlendState;
|
||||
|
||||
@@ -70,6 +70,7 @@ export class TestMaterialStage extends RenderStage {
|
||||
}
|
||||
|
||||
public render(view: RenderView) {
|
||||
// @ts-ignore
|
||||
if (!this._material.inited) {
|
||||
// material
|
||||
this._material.effectName = 'test'; // parsed-effect file is embedded in cocos/3d/builtin/effects.js
|
||||
@@ -79,6 +80,7 @@ export class TestMaterialStage extends RenderStage {
|
||||
const colorHandle = pass.getHandleFromName('u_color');
|
||||
pass.setUniform(colorHandle, cc.color('#ffffff'));
|
||||
pass.update();
|
||||
// @ts-ignore
|
||||
this._material.inited = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,9 @@ export class Pass {
|
||||
}
|
||||
|
||||
public getBindingFromName(name: string) {
|
||||
return parseHandle(this.getHandleFromName(name))[0];
|
||||
const handle = this.getHandleFromName(name);
|
||||
if (handle === undefined) { return -1; }
|
||||
return parseHandle(handle)[0];
|
||||
}
|
||||
|
||||
public setUniform(handle: number, value: any) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { vec3 } from '../../core/vmath';
|
||||
import { Vec3 } from '../../core/value-types';
|
||||
import { Node } from '../../scene-graph';
|
||||
import InputAssembler from '../core/input-assembler';
|
||||
import Effect from '../core/effect';
|
||||
import { Effect } from '../core/effect';
|
||||
import { Pass } from '../core/pass';
|
||||
import { GFXCommandBuffer } from '../../gfx/command-buffer';
|
||||
|
||||
@@ -133,8 +133,8 @@ export default class Model {
|
||||
setEffect(effect: Effect) {
|
||||
if (effect) {
|
||||
this._effect = effect;
|
||||
this._defines = effect.extractDefines(Object.create(null));
|
||||
this._dependencies = effect.extractDependencies(Object.create(null));
|
||||
// this._defines = effect.extractDefines(Object.create(null));
|
||||
// this._dependencies = effect.extractDependencies(Object.create(null));
|
||||
} else {
|
||||
this._effect = null;
|
||||
this._defines = Object.create(null);
|
||||
@@ -167,7 +167,7 @@ export default class Model {
|
||||
out.node = this._node;
|
||||
out.ia = this._inputAssembler;
|
||||
out.effect = this._effect;
|
||||
out.defines = this._effect ? this._effect.extractDefines(this._defines) : this._defines;
|
||||
out.dependencies = this._effect ? this._effect.extractDependencies(this._dependencies) : this._dependencies;
|
||||
// out.defines = this._effect ? this._effect.extractDefines(this._defines) : this._defines;
|
||||
// out.dependencies = this._effect ? this._effect.extractDependencies(this._dependencies) : this._dependencies;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2013-2016 Chukong Technologies Inc.
|
||||
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
declare const CC_BUILD: boolean;
|
||||
declare const CC_TEST: boolean;
|
||||
declare const CC_EDITOR: boolean;
|
||||
declare const CC_PREVIEW: boolean;
|
||||
declare const CC_DEV: boolean;
|
||||
declare const CC_DEBUG: boolean;
|
||||
declare const CC_JSB: boolean;
|
||||
declare const CC_WECHATGAME_SUB: boolean;
|
||||
declare const CC_WECHATGAME: boolean;
|
||||
declare const CC_QQPLAY: boolean;
|
||||
declare const CC_RUNTIME: boolean;
|
||||
declare const CC_SUPPORT_JIT: boolean;
|
||||
|
||||
declare const cc: any;
|
||||
Reference in New Issue
Block a user